Sub topic 15
Connecting Regions with transit gateway peering
This chapter assumes you have read the chapters on transit gateway route tables, association, and propagation. You should also be comfortable with VPC route tables and CIDR blocks.
What peering does
A transit gateway is a regional resource. To join two Regions, you create a peering attachment between a transit gateway in each Region. Traffic between them travels over the AWS global backbone and is encrypted. It does not cross the public internet.
A peering attachment differs from a VPC attachment in two ways:
- The peer can be in another Region or in another AWS account.
- Routes are not propagated across it. You must add static routes yourself.
Create the peering attachment
The requester creates the attachment. The accepter must accept it, even if both gateways are in the same account.
aws ec2 create-transit-gateway-peering-attachment \
--transit-gateway-id tgw-0123456789abcdef0 \
--peer-transit-gateway-id tgw-0fedcba9876543210 \
--peer-account-id 111122223333 \
--peer-region eu-west-1 \
--region us-east-1
aws ec2 accept-transit-gateway-peering-attachment \
--transit-gateway-attachment-id tgw-attach-0aaa1111bbb22222c \
--region eu-west-1The attachment moves from pendingAcceptance to available after acceptance.
Associate and add static routes
The peering attachment needs a route table association like any other attachment. Then, in each Region, add a static route that points the remote CIDR at the peering attachment.
aws ec2 associate-transit-gateway-route-table \
--transit-gateway-route-table-id tgw-rtb-0123456789abcdef0 \
--transit-gateway-attachment-id tgw-attach-0aaa1111bbb22222c \
--region us-east-1
aws ec2 create-transit-gateway-route \
--transit-gateway-route-table-id tgw-rtb-0123456789abcdef0 \
--destination-cidr-block 10.1.0.0/16 \
--transit-gateway-attachment-id tgw-attach-0aaa1111bbb22222c \
--region us-east-1Repeat in eu-west-1 with the destination 10.0.0.0/16. The VPC route tables must also send the remote CIDR to their local transit gateway, as covered in the chapter on VPC route entries.
Constraints to plan for
| Topic | Behavior |
|---|---|
| Routing | Static routes only |
| Overlapping CIDRs | Not routable across the peering |
| Transitivity | Each transit gateway pair needs its own peering |
| Cost | Data transfer charges apply between Regions |
Static routes also take priority over propagated routes when both match the same destination.
Exercise
You created and accepted a peering attachment between two transit gateways, and both VPC route tables point the remote CIDR at their local transit gateway. Traffic still fails. Name two things to check on the transit gateway side.
Show answer
First, check that the peering attachment is associated with a transit gateway route table in each Region. Second, check that each route table has a static route for the remote CIDR that targets the peering attachment, because routes are not propagated over peering.