VPC Peering vs Transit Gateway

Direct VPC-to-VPC connections versus centralized hub-and-spoke network topology.

Overview

What is being compared

Both connect VPCs privately on AWS. VPC Peering creates a direct routing connection between two VPCs. Transit Gateway is a regional hub that connects many VPCs, VPNs and Direct Connect links through a central router. The table sets the two side by side.

  • Topology — Point-to-point, one link per pair — Hub and spoke
  • Transitive routing — No, A to B and B to C does not give A to C — Yes, every attachment can route through the hub
  • Links for 10 VPCs, full mesh — 45 peering connections — 10 attachments
  • Cost — No hourly charge, data transfer only — $0.05 per attachment-hour plus $0.02 per GB processed
  • On-premises access — Per VPC — One VPN or Direct Connect shared by all
  • Overlapping CIDRs — Not allowed — Not allowed
  • Best at — A few VPCs, lowest cost — More than 5 to 10 VPCs

> [!NOTE] A full mesh needs n(n-1)/2 peering connections, so the count grows much faster than the number of VPCs.

The link count is where the choice usually turns. With 10 VPCs, a full mesh needs 10 × 9 / 2 = 45 peering connections, while a Transit Gateway needs one attachment per VPC, 10 in all. Peering stays cheaper while you have a few VPCs, because it has no hourly charge. Past 5 to 10 VPCs, the hub is the better fit.

Sign up free to read the full topic

More Comparisons topics

Start free on Cariara · Coding problems · System design studio