AWS · Comparison

VPC peering vs Transit Gateway

How should I connect VPCs to each other: direct peering, or a Transit Gateway hub?

Decision summary

Use VPC peering for a few VPCs that need a simple, direct link. It has no hourly charge, adds no routing hop, and is easy to reason about.

Use Transit Gateway when the number of networks grows, when VPCs must share a VPN or Direct Connect link, or when you need routing between networks to be transitive and segmented. You pay per attachment-hour and per GB processed for that convenience.

A common design uses both: Transit Gateway for the broad connectivity and direct peering between the two or three VPC pairs that exchange the most traffic.

Best fit for each option

VPC peering

Two or three VPCs, in the same or different accounts or Regions, that need private connectivity with the least cost and no extra hop. Good for a single pair that exchanges large volumes of data.

Transit Gateway

Many VPCs and accounts, a central network team, shared hybrid connectivity, and a need to segment traffic with separate route tables (for example production and development kept apart).

Side by side

 VPC peeringTransit Gateway
Best forA small number of VPC pairs; a single high-volume pairMany VPCs and accounts, shared VPN / Direct Connect, central routing
ScalingOne connection per VPC pair; routes on both sides; roughly n(n-1)/2 for a full meshOne attachment per network; thousands of attachments per gateway; add Regions by peering gateways
PerformanceDirect path, no extra hop; jumbo frames inside a RegionOne managed routing hop; high bandwidth per VPC attachment per Availability Zone
LimitsNot transitive; no edge-to-edge routing; no overlapping CIDRs; 50 active peerings per VPC by defaultRoute and attachment quotas; some limits raised through your AWS account team; no overlapping CIDRs
SecurityControl with route tables, security groups and network ACLs on each sideSegment with gateway route tables and blackhole routes; plus security groups, network ACLs and optional inspection
CostNo hourly charge; data transfer charges depend on whether traffic crosses Availability Zones or RegionsPer attachment-hour plus per GB of data processed, on top of data transfer
AvailabilityManaged and redundant; no single gateway to failManaged and highly available; attach through subnets in several Availability Zones
Operational complexitySimple for two VPCs; becomes laborious as pairs multiplyOne place to manage routes for everything; needs deliberate route-table design

Scaling and topology

VPC peering: a meshVPC 1VPC 2VPC 3VPC 44 VPCs = 6 peerings, no transitTransit Gateway: a hubVPC 1VPC 2VPC 3VPC 4TGWVPN / DXone attachment each, routing is transitive
Peering connects pairs of VPCs; Transit Gateway connects many through one hub

Peering is a mesh: every pair of VPCs that must talk needs its own connection, and each connection needs routes in both VPCs' route tables. Transit Gateway is a hub and spoke: every network attaches once, and the hub's route tables decide who can reach whom.

Because Transit Gateway routing is transitive, VPCs, VPN connections and Direct Connect attachments can all reach one another unless you segment them. Because peering is not, a VPC cannot use a peer's internet gateway, NAT gateway, VPN connection or Direct Connect connection.

Performance considerations

Peering is a direct path between two VPCs, with no appliance in the middle. Transit Gateway adds a routing hop through a managed service, with high per-attachment bandwidth. For most workloads the difference does not matter; for very latency-sensitive traffic between two specific VPCs, a direct peering is the safer choice. Traffic between VPCs can use jumbo frames on both; traffic over VPN is limited to a smaller packet size.

Limits and constraints

ItemValueContextSource
Active VPC peering connections per VPC 50
Can be raised with a quota request
Can be raised up to 125. Source
checked
Unaccepted peering request lifetime 1 week
Fixed limit
Source
checked
MTU over a peering connection 9,001 within a Region; 8,500 between Regions bytes Source
checked
Attachments per transit gateway 5,000
Can be raised with a quota request
Source
checked
Routes across all route tables of one transit gateway 10,000 Raising it goes through your Solutions Architect or Technical Account Manager. Source
checked
Bandwidth per VPC attachment, per Availability Zone Up to 100 Gbps in each direction Source
checked
MTU over VPN connections to a transit gateway 1,500 bytes Source
checked

Quotas and limits change. Check the linked source before designing around a number.

Security implications

Neither option encrypts or filters traffic for you. With peering, you control access with route tables, security groups (which can reference a peer's security group in the same Region) and network ACLs. With Transit Gateway, you add route-table segmentation: attach production and development VPCs to different route tables so both can reach shared services but not each other. Place AWS Network Firewall in an inspection VPC if you need central traffic inspection.

Cost trade-offs by scenario

ScenarioWhat happens to cost
Two VPCs in one Region exchanging modest trafficPeering is cheaper: there is no hourly charge. Transit Gateway adds an hourly charge for each of the two attachments and a per-GB processing charge.
Two VPCs exchanging very large data volumes, all dayPeering avoids the per-GB data-processing charge that Transit Gateway adds on every GB that crosses the hub, which can dominate the bill at high volume.
Thirty VPCs in many accounts, plus a data centreTransit Gateway usually costs less to run overall: one attachment each and one shared VPN or Direct Connect link, instead of hundreds of peerings and a hybrid link per VPC.
Many VPCs whose attachments are idle most of the timeEach attachment is billed for every hour it exists, even with little traffic, so delete attachments you no longer use.
Traffic that crosses Availability Zones or RegionsData transfer charges apply in both designs; the per-GB processing charge applies only to Transit Gateway. Check the current pricing pages for your Regions.

Prices differ by Region and change over time; see the pricing pages linked under Sources.

Operational complexity

Two peerings are trivial to run; forty are not, because each needs routes on both sides, and a missing route is a silent failure. A Transit Gateway centralises routes, and sharing it with AWS Resource Access Manager lets other accounts attach without peering requests. The cost is that a wrong route-table association affects many networks at once, so manage it as infrastructure as code.

When to avoid each option

VPC peering

  • You need A to reach C through B: peering is not transitive.
  • Several VPCs must share one VPN or Direct Connect connection: peering does not allow edge-to-edge routing.
  • You are heading toward dozens of VPCs: a full mesh of n VPCs needs n(n-1)/2 peerings, each with routes on both sides.
  • The VPCs have overlapping IP ranges: peering cannot be created at all.

Transit Gateway

  • Two or three VPCs with light traffic: you would pay attachment-hours and per-GB processing that peering does not charge.
  • Latency-critical traffic between one specific pair, where a direct path is better.
  • Overlapping IP ranges: the gateway cannot route them either; use PrivateLink if you only need to reach one service.

Example scenarios

SituationChooseWhy
Two application VPCs need to share a small amount of data privately, at the lowest cost.VPC peeringNo hourly charge and a simple pair of routes.
60 VPCs in 15 accounts and two data centres connected by VPN, with development isolated from production.Transit GatewayOne hub shared with AWS RAM, with separate route tables to segment environments and one set of VPN attachments for everyone.
VPC A is peered with B, B is peered with C, and A must reach C.Transit GatewayPeering is not transitive. Either add an A to C peering, or move all three onto a Transit Gateway.
Two VPCs with matching IP ranges must reach one internal API.Transit GatewayNeither joins overlapping ranges. Expose just that API with PrivateLink instead of connecting the networks.

Exam cues

  • "Many VPCs across accounts plus on-premises, simplest management" means Transit Gateway.
  • "Two VPCs, lowest cost" means VPC peering.
  • Peering is not transitive. A question where A reaches B and B reaches C, and A must reach C, expects a new peering or a Transit Gateway.
  • Overlapping CIDR ranges rule out peering; for one service, think PrivateLink.
  • Sharing a VPC's subnets with other accounts is VPC sharing through AWS RAM, which is a different thing from either option.

Service pages

Related

Courses and lessons

Services, comparisons and patterns

Sources

Independent study material, not affiliated with or endorsed by Amazon Web Services.

Last reviewed · By the ByteCamel team · How we write content

Was this page helpful?

Report a mistake