Sub topic 15
Connecting Regions with transit gateway peering
This chapter assumes you can create a transit gateway, attach VPCs, and manage transit gateway route tables with association and propagation, as covered in earlier chapters. It also assumes you know basic VPC routing and CIDR notation.
A transit gateway is a regional resource. A VPC in us-east-1 and a VPC in eu-west-1 cannot share one transit gateway. To connect them, you create one transit gateway in each Region and join the two with a peering attachment.
What a peering attachment is
A transit gateway peering attachment links two transit gateways. They can be in different Regions, and they can be in different AWS accounts. Traffic between them travels over the AWS global network, not the public internet, and it is encrypted at the physical and network layers by AWS. You do not manage tunnels, and there is no IPsec configuration.
Peering has a requester and an accepter. The requester creates the attachment. The accepter must accept it before it becomes usable, even when both gateways are in your own account.
Each transit gateway needs its own Amazon-side ASN only if you use BGP-based attachments such as VPN or Direct Connect. Peering attachments do not use BGP. Choose different ASNs for the two gateways anyway, because it avoids problems if you add VPN attachments later.
Creating the peering attachment
Run the request in the requester Region. This example assumes both transit gateways already exist.
aws ec2 create-transit-gateway-peering-attachment \
--region us-east-1 \
--transit-gateway-id tgw-0aaaaaaaaaaaaaaaa \
--peer-transit-gateway-id tgw-0bbbbbbbbbbbbbbbb \
--peer-account-id 111122223333 \
--peer-region eu-west-1The command returns a TransitGatewayAttachmentId such as tgw-attach-0123456789abcdef0 with state initiatingRequest, which moves to pendingAcceptance. Accept it in the accepter Region:
aws ec2 accept-transit-gateway-peering-attachment \
--region eu-west-1 \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0Check the state until it reads available:
aws ec2 describe-transit-gateway-peering-attachments \
--region eu-west-1 \
--transit-gateway-attachment-ids tgw-attach-0123456789abcdef0 \
--query "TransitGatewayPeeringAttachments[0].State"If the state becomes failed or rejected, check that the peer account ID and Region are correct and that the accepter has permission to accept.
Routing is static only
This is the most common source of confusion. Route propagation does not work across a peering attachment. A peering attachment can be associated with a route table, but it cannot propagate its routes into one, and the remote Region's VPC CIDRs do not appear on their own. You must add static routes on both sides.
For each transit gateway, do two things:
- Associate the peering attachment with a transit gateway route table. This table decides where traffic that arrives from the remote Region goes next.
- Add a static route in the table used by your local VPC attachments. It points the remote CIDR at the peering attachment.
For the diagram above, with the VPC attachments already associated with a route table in each Region, the commands look like this:
# us-east-1: route traffic for VPC B to the peering attachment
aws ec2 create-transit-gateway-route \
--region us-east-1 \
--transit-gateway-route-table-id tgw-rtb-0aaaaaaaaaaaaaaaa \
--destination-cidr-block 10.1.0.0/16 \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0
# eu-west-1: route traffic for VPC A to the peering attachment
aws ec2 create-transit-gateway-route \
--region eu-west-1 \
--transit-gateway-route-table-id tgw-rtb-0bbbbbbbbbbbbbbbb \
--destination-cidr-block 10.0.0.0/16 \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0
# Associate the peering attachment so inbound traffic is routed
aws ec2 associate-transit-gateway-route-table \
--region us-east-1 \
--transit-gateway-route-table-id tgw-rtb-0aaaaaaaaaaaaaaaa \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0
aws ec2 associate-transit-gateway-route-table \
--region eu-west-1 \
--transit-gateway-route-table-id tgw-rtb-0bbbbbbbbbbbbbbbb \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0The same attachment ID appears on both sides because it identifies one peering attachment. In the accepter Region, the attachment sometimes shows a different ID in the console view of your own side. Run describe-transit-gateway-peering-attachments in each Region and use the ID that command reports there.
The VPC subnet route tables still need entries that point the remote CIDR at the local transit gateway, as shown in the earlier chapter on VPC route entries. Security groups and network ACLs must also allow the traffic. Security group references to groups in another Region are not supported, so use CIDR ranges.
Edge cases and limits
- No transitive peering. If Region A peers with B and B peers with C, A cannot reach C through B. Create a peering attachment between A and C, or use a full mesh.
- Static routes grow with the design. Every new VPC CIDR needs a route on the remote side. Summarize CIDRs where you can. One
10.0.0.0/12route is easier to manage than sixteen/16routes, as long as the summary does not cover addresses you do not own. - CIDRs must not overlap. Overlapping ranges across peered Regions cannot be routed. The chapter on overlapping CIDRs covers workarounds.
- No Regional failover on its own. If you want a standby path, add a second peering attachment or a VPN, and use route priorities carefully. Static routes to a peering attachment do not fail over by themselves.
- Opt-in Regions. Regions that are disabled by default must be enabled in the account before you peer to them.
- Bandwidth and MTU. Peering attachments support up to 5,500 bytes MTU in the same way VPC attachments do within a Region, but inter-Region traffic is limited to 1,500 bytes MTU in some paths. Test with
ping -M do -s 1472when you see stalls on large transfers, and verify the current limits in the AWS Transit Gateway quotas page. - Multicast is not supported across peering attachments.
Cost
You pay for the peering attachment per hour on each side, plus data processing. Inter-Region data transfer is charged at the usual inter-Region rate. Traffic that crosses a peering attachment can therefore be charged for transfer between Regions and for data processing at the transit gateway. Keep chatty workloads in one Region where possible, and check current prices before sizing a design.
Verifying the path
After the routes exist, confirm each step in order.
- Check that the attachment is
availablein both Regions. - Search each transit gateway route table and look for the remote CIDR with type
staticand the peering attachment as target.
aws ec2 search-transit-gateway-routes \
--region us-east-1 \
--transit-gateway-route-table-id tgw-rtb-0aaaaaaaaaaaaaaaa \
--filters "Name=type,Values=static"- Confirm the VPC subnet route tables contain the remote CIDR with the local transit gateway as target.
- Run Reachability Analyzer from an instance's network interface in VPC A to one in VPC B. It reports the hop where a path breaks.
A common failure is a one-way path: the request arrives but the reply is dropped because the return route is missing in the other Region. Always check both directions.
Exercise
You peered a transit gateway in us-east-1 with one in eu-west-1, and the attachment is available. Instances in VPC A (10.0.0.0/16) can send packets toward VPC B (10.1.0.0/16), but no replies come back. Which two places would you check first?
Show answer
Check the eu-west-1 transit gateway route table for a static route to 10.0.0.0/16 that targets the peering attachment, and check that the peering attachment is associated with a route table in that Region. Also confirm the VPC B subnet route table sends 10.0.0.0/16 to the local transit gateway. Propagation does not supply this route across a peering attachment.