Sub topic 6
Route tables, association, and propagation
This chapter assumes you know VPC route tables and CIDR blocks, and that you have created a transit gateway with attached VPCs (previous chapter). Here you control how traffic moves between those attachments.
Two questions a transit gateway route table answers
A transit gateway route table holds routes for the whole gateway, not for one VPC. Two settings decide how an attachment uses it:
- Association decides which route table is used for traffic coming from an attachment. An attachment is associated with exactly one route table. A route table can have many attachments associated with it.
- Propagation decides which route tables learn the attachment's CIDR, so traffic can be sent to that attachment. An attachment can propagate to many route tables.
Think of association as "which map do I read when I send?" and propagation as "which maps list my address?"
Configure association and propagation
Earlier you created the gateway with default association and propagation disabled. Nothing flows until you do both steps yourself.
aws ec2 create-transit-gateway-route-table \
--transit-gateway-id tgw-0123456789abcdef0
aws ec2 associate-transit-gateway-route-table \
--transit-gateway-route-table-id tgw-rtb-0123456789abcdef0 \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0
aws ec2 enable-transit-gateway-route-table-propagation \
--transit-gateway-route-table-id tgw-rtb-0123456789abcdef0 \
--transit-gateway-attachment-id tgw-attach-0123456789abcdef0The attachment must be in the available state before you can associate it. Check the result with aws ec2 search-transit-gateway-routes, using the table ID and a filter such as Name=state,Values=active.
Propagated and static routes
Propagated routes appear automatically and disappear when you disable propagation or delete the attachment. You can also add static routes, for example a default route 0.0.0.0/0 pointing at an inspection attachment, or a blackhole route that drops traffic for a CIDR. When a static and a propagated route have the same CIDR, the static route wins. Among propagated routes, the most specific prefix wins.
Common errors
| Symptom | Likely cause |
|---|---|
| Traffic goes out but no reply returns | The destination attachment is not associated with a table that has a route back to the source |
| No route to a VPC in the table | Propagation is not enabled for that attachment, or the attachment is not `available` |
| Route exists in the TGW table but traffic still fails | The VPC subnet route table has no entry pointing at the transit gateway |
| Wrong next hop | A static route with the same CIDR overrides the propagated one |
Connectivity needs a route in both directions. The source's table must contain the destination CIDR, and the destination's table must contain the source CIDR.
Exercise
VPC A and VPC B are both associated with route table RT1. VPC A propagates its CIDR into RT1, but VPC B does not propagate anywhere. Which direction of traffic works, and why?
Show answer
Traffic from B to A works at the transit gateway, because B uses RT1 (association) and RT1 contains A's CIDR (propagated). Traffic from A to B fails. A also uses RT1, and RT1 has no route for B's CIDR because B does not propagate. The fix is to enable propagation of B's attachment into RT1, or add a static route for B's CIDR.