Generated banner for Transitgateway
Generated logo for Transitgateway

Transitgateway

AWSOfficialPublished by AWS

  • Skill
  • Workflow
  • Cloud and DevOps
  • Apache-2.0
  • No issues found

From the author

Configures AWS Transit Gateway: creating a hub and attaching VPCs, segmenting traffic with route tables, centralizing egress and inspection through a hub (appliances or a Gateway Load Balancer endpoint), forcing east-west traffic between VPCs through AWS Network Firewall, connecting on-premises networks over the transit-gateway side of a Site-to-Site VPN or Direct Connect attachment (including ECMP to aggregate bandwidth across multiple VPN tunnels), peering transit gateways across Regions, migrating from a VPC peering mesh, and routing IP multicast. Applicable when connecting many VPCs through one router, isolating environments, forcing VPC-to-VPC traffic through a central Network Firewall, reaching on-premises over the hub, linking Regions, or moving off a peering mesh. Not applicable for single-VPC routing, VPC peering between two VPCs (vpcpeering skill), Direct Connect gateway or virtual interface setup (directconnect skill), or Route 53 DNS work.
— the description by AWS

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured framework for deploying and managing AWS Transit Gateway, acting as a regional network hub. It streamlines the connection of multiple VPCs and on-premises networks, replacing complex point-to-point peering meshes with a centralized routing architecture. The skill covers the full lifecycle of transit gateway operations, including hub creation, traffic segmentation, centralized egress and inspection, hybrid connectivity, and inter-region peering.

What it does

  • Creates and configures regional transit gateway hubs and VPC attachments.
  • Implements traffic segmentation using custom route tables to isolate or share network environments.
  • Centralizes egress and inspection traffic through dedicated VPCs using appliances or Gateway Load Balancer endpoints.
  • Facilitates hybrid connectivity via Site-to-Site VPN and Direct Connect, including ECMP for bandwidth aggregation.
  • Manages inter-region peering and migration from existing VPC peering meshes.
  • Configures IP multicast routing across attached VPCs.

When to use it

  • When you need to connect a large number of VPCs through a single, manageable router.
  • When you require centralized inspection of traffic between VPCs or to the internet.
  • When you need to isolate network environments while maintaining controlled access to shared services.
  • When you are migrating from a complex, unmanageable VPC peering mesh.
  • When you need to connect on-premises data centers to multiple VPCs efficiently.

Advantages

  • Reduces network complexity by replacing point-to-point connections with a hub-and-spoke model.
  • Enables consistent security enforcement through centralized inspection points.
  • Supports scalable hybrid connectivity with options for performance optimization.
  • Provides granular control over traffic flow via route table associations and propagations.
  • Simplifies management of multi-region and multi-VPC network architectures.

Usage examples

“How do I set up a transit gateway to connect three VPCs and ensure they are isolated from each other?”
The agent will guide you through creating the transit gateway, attaching the VPCs, and configuring separate route tables to prevent cross-VPC communication.
“I need to route all outbound traffic from my spoke VPCs through a central inspection VPC using a Gateway Load Balancer.”
The agent will provide the steps to configure the central inspection VPC, set up the GWLB endpoint, and update route tables to force traffic through the inspection path.
“Can you help me enable ECMP for my multiple VPN tunnels to increase bandwidth?”
The agent will verify that you are using dynamic BGP routing and guide you through the configuration to aggregate bandwidth across your VPN tunnels.
“We are moving off a VPC peering mesh. How do we migrate to a transit gateway without downtime?”
The agent will outline a migration strategy, including creating the transit gateway, establishing attachments, and incrementally updating routes to transition traffic.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/aws/transitgateway/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip transitgateway.zip -d .agents/skills

Documentation by AWS

AWS Transit Gateway

Overview

Domain expertise for configuring AWS Transit Gateway, the Regional network hub that connects many VPCs and on-premises networks through a single router instead of a mesh of point-to-point connections. Covers building the hub and attaching VPCs, segmenting traffic with route tables, centralizing egress and inspection, east-west inspection with AWS Network Firewall, hybrid connectivity over Site-to-Site VPN and Direct Connect, inter-Region peering, migrating off a VPC peering mesh, and IP multicast.

This skill is a router. Each customer task maps to a procedure file under references/. Read the matching reference in full before acting, then follow its constraints and steps. The reference files are self-contained: each carries its own decision tables, constraints, procedure, and troubleshooting.

Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise. All CLI operations require least-privilege, ephemeral credentials (an assumed IAM role through AWS STS or AWS IAM Identity Center / SSO), never long-lived IAM user access keys. A transit gateway is a Regional resource: run each aws ec2 transit gateway command in the Region that holds the hub.

Which Transit Gateway task do you need?

GoalReference
Create a Regional hub and connect VPCs to itcreating a transit gateway and attaching VPCs
Isolate some VPCs while letting others share servicessegmenting traffic with route tables
Send all spoke traffic out through one inspected egress VPCcentralizing egress and inspection
Inspect traffic between VPCs with AWS Network Firewallinspecting east-west traffic with Network Firewall
Reach on-premises networks over Site-to-Site VPN or Direct Connectconnecting on-premises networks
Link transit gateways in two Regions over the AWS networkpeering transit gateways across Regions
Move off a VPC peering mesh without dropping trafficmigrating from VPC peering
Distribute IP multicast across attached VPCsrouting multicast traffic

Routing notes

  • Decide segmentation before you build. "Default route table association" and "Default route table propagation" are on by default, which wires every attachment into one open mesh. If the customer plans isolated environments, the creating reference disables the defaults up front and hands off to the segmenting reference. Retrofitting isolation onto an open hub is a re-architect.

  • North-south egress vs east-west inspection. Centralizing egress sends spoke traffic out to the internet through a central VPC. East-west inspection keeps traffic between spokes internal and forces it through a firewall on the way. They look similar but use different route table recipes. Match the reference to the direction of traffic the customer actually has.

  • Appliance vs Gateway Load Balancer for inspection. Raw third-party appliances and a Gateway Load Balancer (GWLB) endpoint are two paths to the same goal. GWLB is the recommended approach for new designs. Both live in the centralizing-egress reference; appliance mode and the GWLB endpoint route table entries differ and the reference covers each.

  • Appliance mode is required for stateful cross-Availability-Zone inspection, with a tradeoff. Appliance mode keeps each flow on one Availability Zone's appliance so request and response do not split. It also disables cross-Availability-Zone failover for that attachment, so the inspection design must pair it with health-check-based failover. Both the egress and east-west references carry this.

  • Transit gateway side vs Direct Connect side. The connecting-on-premises reference covers the transit gateway side: Site-to-Site VPN attachment options, route propagation, and equal-cost multi-path (ECMP). The Direct Connect gateway and virtual interface setup belongs to the separate directconnect skill. Do not restate the Direct Connect side here.

Security considerations

A transit gateway is the central routing point for many VPCs and on-premises networks, so a misconfiguration here has blast radius across every attached network. Apply these controls regardless of the specific task; each per-task reference carries the detail.

  • You MUST enable Transit Gateway Flow Logs for traffic visibility, audit, and incident response across the hub, and MUST enable encryption at rest on the destination (a KMS key on the CloudWatch log group, or SSE-KMS on the S3 bucket).

  • You MUST, when a KMS key encrypts a flow log destination (CloudWatch log group or S3 bucket) or a CloudTrail destination, scope the KMS key policy with condition keys (aws:SourceArn, aws:SourceAccount, and kms:ViaService) so only the specific log group, bucket, or trail in the expected account and service can use the key, preventing cross-account or cross-service misuse.

  • You SHOULD apply least-privilege IAM for transit gateway administration, avoiding service wildcards and FullAccess policies, restricting who can create attachments, modify route tables, and change associations or propagations.

  • You SHOULD ensure Site-to-Site VPN tunnels use strong encryption (for example AES-256-GCM with IKEv2) and enable tunnel logging to CloudWatch Logs with encryption enabled (a KMS key) to protect sensitive connection state and IKE negotiation detail from unauthorized access (see the connecting on-premises networks reference).

  • You MUST treat a misconfigured transit gateway route table as a security risk, since wrong associations or propagations can expose workloads across environments meant to stay isolated (see the segmenting traffic reference).

  • You MUST enable AWS CloudTrail to detect unauthorized changes to transit gateway route tables, associations, and propagations, MUST enable encryption at rest on the CloudTrail destination (a KMS key), and use AWS Config rules to detect drift from the intended design.

Additional Resources

Files

references/connecting-on-premises-networks.md

Connecting On-Premises Networks Over VPN or Direct Connect

Overview

Domain expertise for the transit gateway side of reaching on-premises data centers through one hub, over a Site-to-Site VPN or AWS Direct Connect, instead of a separate tunnel into each VPC. Covers the static-versus-dynamic VPN routing difference, equal-cost multi-path (ECMP) across multiple tunnels and what it requires, the accelerated Site-to-Site VPN option, and the association and propagation wiring that decides where on-premises routes land.

Does not cover the Direct Connect gateway and virtual interface setup, which belongs to the directconnect skill. This reference covers the transit-gateway-side configuration only. Creating the hub, segmentation, egress, peering, and multicast are separate references.

Execute commands using the AWS MCP server when connected (sandboxed execution, audit logging, observability). Fall back to the AWS CLI otherwise. A transit gateway is Regional; run every command in the Region that holds the hub.

Table of Contents

  • Overview

  • Workflow

  • Decision: static vs dynamic VPN routing

  • ECMP across multiple tunnels

  • Accelerated Site-to-Site VPN

  • Association and propagation wiring

  • Direct Connect side belongs to the directconnect skill

  • Security considerations

  • Troubleshooting

  • Procedure

  • Additional Resources

Workflow

To connect on-premises over the transit gateway end to end, follow the procedure exactly. See the Procedure section below. It covers creating the VPN attachment (or, for Direct Connect, associating the Direct Connect gateway after the directconnect skill has set it up), choosing the routing model, deciding on ECMP and accelerated VPN, wiring association and propagation, and surfacing the console link to verify.

Decision: static vs dynamic VPN routing

RoutingBehavior
Dynamic (BGP)The Site-to-Site VPN learns and filters routes via BGP. Supports ECMP across tunnels
StaticThe customer adds routes by hand. Static routes that target a VPN attachment are not filtered by the Site-to-Site VPN, which can allow unintended outbound traffic

Constraints:

  • You MUST call out that static routes targeting a VPN attachment are not filtered, when the customer picks static

  • You MUST add the static routes to the transit gateway route table as a required step when static is chosen

  • You SHOULD prefer dynamic (BGP) routing where the customer gateway device supports it

ECMP across multiple tunnels

Customers attach multiple Site-to-Site VPN tunnels to aggregate bandwidth and expect the traffic to spread, then find it pins to one tunnel. Equal-cost multi-path (ECMP) routing is only supported with dynamic (BGP) routing, not static, and only when the tunnels terminate on the same transit gateway.

Constraints:

  • You MUST confirm BGP is in use before promising bandwidth aggregation across tunnels

  • You MUST confirm the tunnels terminate on the same transit gateway for ECMP to apply

  • You MUST NOT promise aggregation for static tunnels, since they will not spread load

Accelerated Site-to-Site VPN

When a customer chooses VPN over Direct Connect for cost or simplicity, the accelerated Site-to-Site VPN option routes the tunnel over the AWS global network through Global Accelerator edge locations and materially improves latency and jitter. It is set at VPN creation and is not discoverable in the standard flow.

Constraints:

  • You SHOULD surface accelerated VPN as a decision point when the customer chooses VPN, so they can weigh the performance gain before the connection is built

  • You MUST set the accelerated option at VPN creation, since it cannot be toggled on an existing VPN

Association and propagation wiring

After the attachment, on-premises prefixes only reach the VPCs whose attachments share a route table with the path. Finishing the attachment does not make on-premises routes appear everywhere.

Constraints:

  • You MUST confirm the association and propagation wiring so the hybrid routes land where the customer expects

  • You MUST verify the on-premises prefixes reach the intended VPC attachments, not assume they propagate everywhere

Direct Connect side belongs to the directconnect skill

Associating a Direct Connect gateway with the transit gateway, assigning a unique Autonomous System Number per transit gateway, and checking the Direct Connect gateway is free of conflicting virtual private gateway or private virtual interface bindings are Direct Connect concerns.

Constraints:

  • You MUST route the Direct Connect gateway and virtual interface setup to the directconnect skill, specifically the "connecting many VPCs through a Direct Connect gateway" reference

  • You MUST NOT restate the Direct Connect side here; cover only the transit gateway association once the Direct Connect gateway exists

Security considerations

Hybrid connectivity extends the trust boundary to an on-premises network over a tunnel that carries sensitive traffic and connection state, so encryption, credential handling, and route hygiene matter here. The controls are embedded in the procedure; this section consolidates them.

Constraints:

  • You MUST set Site-to-Site VPN tunnel options that enforce strong encryption (IKEv2 with AES-256 and AES256-GCM-16) rather than relying on AWS defaults, which may permit weaker ciphers

  • You MUST, when a customer-specified pre-shared key (PSK) is used (via TunnelOptions[].PreSharedKey), store and retrieve it from AWS Secrets Manager, never hardcoding it in scripts or configuration files; prefer the AWS-generated PSK when no specific value is required

  • You MUST call out that static routes targeting a VPN attachment are not filtered and can allow unintended outbound traffic, and SHOULD prefer dynamic (BGP) routing where the customer gateway device supports it

  • You SHOULD enable Site-to-Site VPN tunnel logging to CloudWatch Logs with encryption enabled, since the logs carry connection state and IKE negotiation detail

  • You MUST enable VPC Flow Logs on the attached VPC subnets and Transit Gateway Flow Logs on the hub with encryption at rest on the destination, and you SHOULD enable AWS CloudTrail (encrypted) to detect unauthorized changes to attachments, route tables, associations, and propagations

  • You MUST, when a KMS key encrypts a flow log, tunnel log, or CloudTrail destination, scope the KMS key policy with condition keys (aws:SourceArn, aws:SourceAccount, kms:ViaService) so only the specific log group, bucket, or trail in the expected account and service can use the key

  • You SHOULD apply least-privilege IAM for transit gateway administration, avoiding service wildcards and FullAccess policies

Troubleshooting

Unintended outbound traffic over a static VPN

Static routes to a VPN attachment are not filtered. Tighten the routes or move to dynamic (BGP).

Multiple VPN tunnels do not aggregate bandwidth

ECMP needs BGP and tunnels on the same transit gateway. Confirm both; static will not aggregate.

VPN performance is poor over the public internet

The accelerated VPN option was not chosen. It must be set at creation; recreate the VPN to enable it.

On-premises routes do not reach a VPC

The attachment does not share a route table with the path. Fix the association and propagation.

Procedure

Overview

This procedure creates the VPN attachment with the right routing model, decides ECMP and accelerated VPN, wires association and propagation, and surfaces the console link to verify. For Direct Connect, it assumes the directconnect skill has set up the Direct Connect gateway.

Parameters
  • region (required): The Region that holds the hub.

  • transit_gateway_id (required): The transit gateway.

  • connection_type (required): vpn or directconnect.

  • vpn_routing (required for VPN): dynamic or static.

  • customer_gateway_id (required for VPN): The customer gateway device.

  • accelerated (optional for VPN): Whether to use the accelerated VPN option.

  • dx_gateway_id (required for Direct Connect): The Direct Connect gateway ID created by the directconnect skill.

  • allowed_prefix (required for Direct Connect): The CIDR prefix to allow through the Direct Connect gateway association.

Constraints for parameter acquisition:

  • You MUST ask for all required parameters upfront in a single prompt

  • You MUST ask whether bandwidth aggregation across tunnels is needed (decides BGP and ECMP)

Steps
1. Verify dependencies

Constraints:

  • You MUST confirm credentials with aws sts get-caller-identity, and you MUST use short-lived, ephemeral credentials scoped to least privilege for transit gateway administration, never long-lived access keys or broad service wildcard or FullAccess policies

  • You MUST, for Direct Connect, confirm the directconnect skill has created the Direct Connect gateway before associating it

  • You MUST enable VPC Flow Logs on the attached VPC subnets and Transit Gateway Flow Logs on the hub for traffic visibility, audit, and incident response across every attached network. These logs carry sensitive traffic data, so you MUST enable encryption at rest on the destination (a KMS key on the CloudWatch log group, or SSE-KMS on the S3 bucket)

  • You SHOULD enable AWS CloudTrail to record transit gateway attachment, route table, association, and propagation changes for audit and unauthorized-change detection, and you MUST enable encryption at rest on the CloudTrail destination (a KMS key)

  • You MUST, when a KMS key encrypts a flow log destination (CloudWatch log group or S3 bucket) or the CloudTrail destination, scope the KMS key policy with condition keys (aws:SourceArn, aws:SourceAccount, and kms:ViaService) so only the specific log group, bucket, or trail in the expected account and service can use the key, preventing cross-account or cross-service misuse

  • You SHOULD create CloudWatch alarms for transit gateway attachment creation and deletion, route table changes, and failed or blocked attachment states, so that unexpected or unauthorized changes and failure conditions are surfaced for investigation rather than discovered after impact

2. Create the VPN attachment (VPN path)

Constraints:

  • You MUST create the Site-to-Site VPN attached to the transit gateway, with the chosen routing and accelerated option (a single call creates both the VPN connection and the transit gateway VPN attachment). You MUST set tunnel options that enforce strong encryption (IKEv2 with AES-256 and AES256-GCM-16) rather than relying on AWS defaults, which may permit weaker ciphers. Phase 1 uses AES-256-CBC, which is not AEAD, so you MUST also pin Phase1IntegrityAlgorithms and Phase1DHGroupNumbers (otherwise AWS fills them in and may permit SHA-1 or weak Diffie-Hellman groups such as Group 2); Phase 2's AES256-GCM-16 is AEAD and needs no separate integrity algorithm, but pin Phase2DHGroupNumbers for forward secrecy:

    aws ec2 create-vpn-connection --type ipsec.1 \
      --customer-gateway-id {customer_gateway_id} \
      --transit-gateway-id {transit_gateway_id} \
      --options "EnableAcceleration={accelerated},StaticRoutesOnly={static_only},TunnelOptions=[{IKEVersions=[{Value=ikev2}],Phase1EncryptionAlgorithms=[{Value=AES256}],Phase1IntegrityAlgorithms=[{Value=SHA2-512}],Phase1DHGroupNumbers=[{Value=20}],Phase2EncryptionAlgorithms=[{Value=AES256-GCM-16}],Phase2DHGroupNumbers=[{Value=20}]},{IKEVersions=[{Value=ikev2}],Phase1EncryptionAlgorithms=[{Value=AES256}],Phase1IntegrityAlgorithms=[{Value=SHA2-512}],Phase1DHGroupNumbers=[{Value=20}],Phase2EncryptionAlgorithms=[{Value=AES256-GCM-16}],Phase2DHGroupNumbers=[{Value=20}]}]" \
      --region {region}
  • You MUST capture the VpnConnectionId from the response

  • You MUST poll until the VPN connection reaches available:

    aws ec2 describe-vpn-connections \
      --vpn-connection-ids {vpn_connection_id} --region {region}
  • You MUST add static routes to the transit gateway route table when vpn_routing is static

  • You MUST, when a customer-specified pre-shared key (PSK) is used for an IPsec tunnel (via TunnelOptions[].PreSharedKey), store and retrieve it from AWS Secrets Manager, never hardcoding it in scripts or configuration files. Prefer the AWS-generated PSK when the customer has no requirement for a specific value

  • You SHOULD enable Site-to-Site VPN tunnel logging to CloudWatch Logs for visibility into tunnel state changes, IKE negotiation failures, and dead peer detection events, which are critical for troubleshooting connectivity and detecting unauthorized connection attempts. These logs carry connection state and IKE negotiation detail, so you MUST enable encryption (a KMS key) on the destination CloudWatch log group

3. Associate the Direct Connect gateway (Direct Connect path)

Constraints:

  • You MUST create the association from the transit gateway to the Direct Connect gateway the directconnect skill set up:

    aws directconnect create-direct-connect-gateway-association \
      --direct-connect-gateway-id {dx_gateway_id} \
      --gateway-id {transit_gateway_id} \
      --add-allowed-prefixes-to-direct-connect-gateway cidr={allowed_prefix} --region {region}
  • You MUST poll the association state until it reaches associated (this is an async operation that can take several minutes):

    aws directconnect describe-direct-connect-gateway-associations \
      --direct-connect-gateway-id {dx_gateway_id} --region {region}
  • You MUST NOT configure the Direct Connect gateway or virtual interface here

4. Wire association and propagation

Constraints:

  • You MUST associate the attachment with the route table whose VPCs should reach on-premises, and propagate on-premises routes into the tables that need them

  • You MUST verify the on-premises prefixes reach the intended attachments

Constraints:

  • You MUST confirm the attachment is available:

    aws ec2 describe-transit-gateway-attachments \
      --filters Name=transit-gateway-id,Values={transit_gateway_id} --region {region}
  • You MUST present the transit gateway console link, filling {transit_gateway_id} and {region} from the API response, and tell the customer to open it and verify the attachment and routes:

    https://{region}.console.aws.amazon.com/vpc/home?region={region}#TransitGatewayDetails:transitGatewayId={transit_gateway_id}
Example
Example input
{
  "region": "us-east-1",
  "transit_gateway_id": "tgw-0abc",
  "connection_type": "vpn",
  "vpn_routing": "dynamic",
  "customer_gateway_id": "cgw-0def",
  "accelerated": true
}
Example output
Created an accelerated Site-to-Site VPN with dynamic (BGP) routing and attached it to tgw-0abc.
ECMP available: BGP in use and tunnels terminate on the same transit gateway.
Associated the attachment with the route table whose VPCs reach on-premises; propagated on-premises
routes into it.
Open the transit gateway console and verify the attachment and routes:
https://us-east-1.console.aws.amazon.com/vpc/home?region=us-east-1#TransitGatewayDetails:transitGatewayId=tgw-0abc
Troubleshooting
Tunnels do not aggregate bandwidth

ECMP needs BGP and tunnels on one transit gateway. Confirm both (ECMP across multiple tunnels).

Poor VPN performance

Accelerated VPN was not enabled at creation. Recreate with the accelerated option (Step 2).

On-premises routes missing from a VPC

Association or propagation is wrong. Fix the wiring (Step 4).

Additional Resources

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an MCP server

Security

No issues found by our static scan· No issues found

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
AWS
Publisher
AWS (Official)
Source
aws/agent-toolkit-for-aws · skills/specialized-skills/networking-and-content-delivery-skills/transitgateway · commit 0a218f8
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • NOTICE (added by AutoGineer from NOTICE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by AWS or AWS.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download transitgateway.zip