Q: When would you choose AWS Transit Gateway versus VPC Peering, and why?
Deep architectural comparison between AWS VPC Peering and AWS Transit Gateway, covering routing complexity, bandwidth, pricing, and scaling limits.
Want to master this scenario in a live sandbox? KodeKloud's Istio Service Mesh & Advanced Kubernetes Networking Course covers this exact problem with hands-on terminal drills.
🛠️ Production Runbook & Step-by-Step Resolution
Direct Answer: The choice between AWS VPC Peering and AWS Transit Gateway comes down to scale, operational complexity, transitive routing needs, and cost. VPC Peering is a point-to-point, non-transitive connection with zero hourly cost and highest performance. Transit Gateway is a centralized cloud router that simplifies complex multi-VPC and hybrid-cloud topologies at the cost of hourly attachment fees and data processing charges.
Architecture & Transitive Routing Comparison
VPC Peering does NOT support transitive routing (VPC A cannot talk to VPC C through VPC B). For N VPCs to communicate fully via peering, you require N*(N-1)/2 peering connections (e.g. 50 VPCs require 1,225 peering links), creating an unmanageable routing table mesh. Transit Gateway acts as a central hub (hub-and-spoke), supporting transitive routing across hundreds of VPCs, VPNs, and Direct Connect links.
Performance & Bandwidth Comparison
VPC Peering has no bandwidth limits or single-point-of-failure choke points; traffic flows over the AWS global backbone at line rate with zero added latency. Transit Gateway has a limit of 50 Gbps per VPC attachment burst (expandable via ECMP) and introduces a negligible sub-millisecond hop.
Cost Model Breakdown
Cost structures are fundamentally different: - VPC Peering: $0.00 base cost per hour. Standard inter-AZ data transfer fees apply ($0.01/GB). Same-AZ peering is completely FREE. - Transit Gateway: $0.05/hour per attachment ($36.50/month per VPC) + $0.02 per GB data processing fee ON TOP of standard data transfer fees.
# Cost Example: 20 VPCs transferring 50 TB/month
# VPC Peering: ~$500 in data transfer
# Transit Gateway: (20 * $36.50) + (50,000 GB * $0.02) + data transfer = ~$2,230/month
Centralized Network Security & Inspection
Transit Gateway allows routing all east-west and north-south traffic through a centralized 'Security/Inspection VPC' containing AWS Network Firewall or Palo Alto appliances before forwarding to destinations. VPC Peering cannot achieve this without complex proxying.
- Use VPC Peering for 1-to-1 high-bandwidth connections with zero hourly cost and line-rate performance.
- Use Transit Gateway for hub-and-spoke architectures connecting 10+ VPCs, VPNs, and Direct Connect.
- Transit Gateway enables transitive routing and centralized firewall traffic inspection.
- Consider cost: Transit Gateway charges $0.05/hr per attachment plus $0.02/GB data processing fees.
Senior hiring managers and bar raisers evaluate how you prioritize during outages. Avoid these common anti-patterns:
- Treating stateless Network ACLs as stateful firewalls without specifying outbound ephemeral return ports when configuring Transit Gateway Peering Security Groups track connection state automatically, whereas stateless Network ACLs require explicit ephemeral port rules (1024-65535) for return traffic.
- Opening short-lived non-pooled TCP client connections, exhausting ephemeral ports in TIME_WAIT state when configuring Transit Gateway Peering Rapidly opening and closing short-lived TCP sockets without connection pooling exhausts ephemeral ports, causing connection refusal errors.
- Directing load balancer health checks to heavy computational endpoints rather than dedicated health routes when configuring Transit Gateway Peering Deep health check paths amplify database load during traffic spikes and risk cascading eviction of healthy application nodes.
- Triggering BGP route dampening by rapidly announcing and withdrawing multihomed network prefixes when configuring Transit Gateway Peering Rapidly flapping BGP route announcements triggers upstream ISP route dampening, effectively blackholing network traffic for hours.