Transit Gateway and VPC peering
Connect networks without mixing them
Suppose an application VPC uses 10.10.0.0/16 and a data VPC uses 10.20.0.0/16. VPC peering provides direct private IP connectivity between two VPCs, including across accounts and supported Regions. Both owners must arrange acceptance, routes and security rules. A third VPC peered with the data VPC cannot automatically reach the application VPC through it. Peering is not a router for other networks. Overlapping CIDRs block peering; unique IPv6 prefixes do not fix overlapping IPv4 ranges. Plan addresses before connecting networks.
A hub with explicit routes
Transit Gateway (TGW) is a regional routing hub. An attachment connects a VPC or supported network to the hub. Association selects the TGW route table consulted for traffic arriving from an attachment; propagation installs eligible learned prefixes into selected tables. These are separate operations. Each VPC subnet still needs routes toward TGW. For the example below, an application-to-data packet needs a subnet route, a TGW route to the data attachment, and a return path. Use distinct tables to isolate development from production, and avoid propagating routes that defeat isolation. Longest-prefix match selects the most specific matching prefix; actual AWS route priority includes additional rules for equal prefixes.
app 10.10.0.0/16 <--> TGW <--> data 10.20.0.0/16 | branch 172.16.0.0/16 (VPN)Inspection and account boundaries
For centralized IPv4 internet egress, spokes can route default traffic through TGW to an egress VPC with NAT and internet gateway. A stateful firewall must see both directions of the same flow; asymmetric routes may break connections. Design inspection attachment appliance mode and route tables together, and check AZ failure behavior. IPv6 uses separate routes and, for outbound-only internet connectivity, an egress-only internet gateway where appropriate; do not assume IPv4 NAT design applies. VPC sharing through AWS RAM instead lets participants in one AWS Organization deploy supported resources in owner-managed subnets. It does not merge account ownership. A shared TGW can connect different VPCs across accounts subject to attachment permissions and acceptance.
Practice: choose a topology
For two isolated VPCs, peering is often simpler than a hub. For many interconnected networks, TGW reduces the number of point-to-point links but introduces attachment and processing charges. Central egress adds NAT, firewall and possible inter-AZ transfer charges; a hub is not automatically cheaper. In the offline diagram, remove the return route from data to app and predict a one-way path. Restore it, then replace the data prefix with a conflicting range. Reject overlap rather than hoping the hub will disambiguate it. A route is necessary, not sufficient: security groups, network ACLs and host services must also permit traffic.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Transit Gateway and VPC peering — knowledge check
Reason about synthetic hybrid networking scenarios.
A peers with B and B peers with C. Does A automatically reach C?
What prevents peering even with unique IPv6 prefixes?
Which TGW operation selects the table used for incoming traffic?
What is essential for stateful centralized inspection?
What does VPC subnet sharing allow?