Sub topic 12
Peering and Transit Gateway cost trade-offs
This chapter assumes you know VPCs, subnets, route tables, and Availability Zones (AZs). It also assumes you have read the earlier chapters on traffic paths and inter-AZ charges. Prices below are illustrative figures for us-east-1. Check the current pricing pages before you make a decision, because rates differ by region and change over time.
The two cost models
VPC peering and AWS Transit Gateway (TGW) connect VPCs, but they bill differently.
- VPC peering is a direct, one-to-one link between two VPCs. It has no hourly charge and no data processing charge. You pay only the normal data transfer rates for the path the traffic takes.
- Transit Gateway is a regional hub that VPCs attach to. You pay an hourly fee for each attachment and a per-GB data processing fee for traffic sent into the gateway. Typical us-east-1 figures are $0.05 per attachment-hour and $0.02 per GB.
| Property | VPC peering | Transit Gateway |
|---|---|---|
| Hourly cost | None | Per attachment, about $0.05/hour (about $36.50/month) |
| Per-GB processing | None | About $0.02/GB |
| Same-AZ traffic | Free | Still pays the processing fee |
| Cross-AZ traffic | Standard inter-AZ rate, $0.01/GB each direction | Processing fee only, with no separate inter-AZ charge |
| Cross-region traffic | Inter-region transfer rate | Attachment fees plus inter-region transfer rate |
| Transitive routing | No | Yes |
| Connections for N VPCs | N(N-1)/2 | N attachments |
The central point is that peering is cheaper per byte, and TGW is cheaper to operate as the number of VPCs grows. The decision is a trade-off between data volume and the number of connections.
What peering really costs
Peering looks free, but the traffic path still determines the price.
- Same region, same AZ: free. The AZ is identified by AZ ID (for example
use1-az1), not by AZ name, because names map to different physical zones in different accounts. - Same region, different AZ: $0.01/GB charged on the sending side and $0.01/GB on the receiving side. Each gigabyte therefore costs about $0.02 in total.
- Cross-region: the inter-region rate applies to traffic leaving the source region. It is about $0.02/GB in most us-east-1 paths.
Peering also has operational costs that never show up on the bill:
- It is non-transitive. If A peers with B and B peers with C, A cannot reach C through B. You need an A-C peering too.
- CIDR ranges must not overlap.
- Every new VPC needs routes and peering requests for each existing VPC.
- Security groups can reference peer security groups only in some configurations. Plan for CIDR-based rules in the others.
What Transit Gateway really costs
TGW charges apply per attachment and per GB sent into the gateway. Three details catch teams out.
Idle attachments still cost money. An attachment costs about $36.50 per month even with no traffic. Twenty forgotten dev VPC attachments cost about $730 per month.
Processing is billed once per hop into the gateway. Traffic from VPC A to VPC B pays the processing fee once, on the way into the gateway from A. The reply from B pays it again. Traffic is billed in each direction it flows.
Centralized egress stacks fees. A common design routes all VPCs through a TGW to a shared egress VPC with a NAT gateway. Every gigabyte to the internet then pays the TGW processing fee ($0.02) and the NAT gateway processing fee ($0.045). That adds up to $0.065/GB before any internet transfer charge. For high-volume workloads, a NAT gateway or an endpoint in each VPC can be cheaper than a shared one. Fewer NAT gateways save hourly fees, so the break-even depends on volume.
Finding the break-even point
You can estimate which option is cheaper with a small calculation. The worst case for peering is that all traffic crosses AZs, so peering costs $0.02/GB in total. TGW always costs the processing fee, so that is $0.02/GB plus attachment hours. In the worst case peering therefore equals TGW's per-GB cost and never exceeds it. TGW wins only when it saves you from managing many connections or provides routing features that peering lacks.
The following script compares both options for a given set of VPCs.
"""Compare monthly cost of full-mesh peering vs Transit Gateway.
Rates are illustrative us-east-1 figures; update them from the pricing pages."""
HOURS_PER_MONTH = 730
TGW_ATTACHMENT_HOUR = 0.05 # USD per attachment-hour
TGW_PER_GB = 0.02 # USD per GB processed
INTER_AZ_PER_GB = 0.02 # USD per GB, both directions combined
def peering_cost(total_gb: float, cross_az_share: float) -> float:
"""Peering has no fixed fee. Only cross-AZ traffic is charged."""
return total_gb * cross_az_share * INTER_AZ_PER_GB
def tgw_cost(vpcs: int, total_gb: float) -> float:
attachments = vpcs * TGW_ATTACHMENT_HOUR * HOURS_PER_MONTH
processing = total_gb * TGW_PER_GB
return attachments + processing
def mesh_links(vpcs: int) -> int:
return vpcs * (vpcs - 1) // 2
if __name__ == "__main__":
vpcs = 10
total_gb = 20 * 1024 # 20 TB per month between VPCs
for share in (0.0, 0.5, 1.0):
print(
f"cross-AZ share {share:.0%}: "
f"peering ${peering_cost(total_gb, share):,.2f}, "
f"TGW ${tgw_cost(vpcs, total_gb):,.2f}"
)
print(f"Peering links needed for {vpcs} VPCs: {mesh_links(vpcs)}")With 10 VPCs and 20 TB per month, TGW costs about $774.60 whatever the traffic path. Peering costs $0 at 0% cross-AZ traffic and $409.60 at 100%. Peering needs 45 links, which is where the operational cost comes in.
Spotting these charges in your bill
Use Cost Explorer usage types, as covered earlier in this tutorial. TGW charges appear as TransitGateway-Hours and TransitGateway-Bytes, prefixed by a region code such as USE1-. Peering traffic shows up under the regular regional or inter-region transfer usage types, so it is harder to separate from other inter-AZ traffic.
aws ce get-cost-and-usage \
--time-period Start=2026-10-01,End=2026-11-01 \
--granularity MONTHLY \
--metrics UnblendedCost \
--group-by Type=DIMENSION,Key=USAGE_TYPE \
--query "ResultsByTime[].Groups[?contains(Keys[0], 'TransitGateway')].[Keys[0], Metrics.UnblendedCost.Amount]" \
--output textCompare the -Hours line to the -Bytes line. If hours dominate, you are paying for attachments that move little data, and you should consider removing attachments or switching low-volume pairs to peering. If bytes dominate, look for a few high-volume pairs that could be peered directly or moved into one AZ.
Hybrid designs
You do not have to choose one model for everything. A common pattern is to use TGW as the default hub and add direct peering for the few pairs that exchange the most data.
- TGW provides the shared routing, centralized inspection, and VPN or Direct Connect attachments.
- Peering between two heavy VPCs bypasses the per-GB fee for the bulk traffic.
- Routes are chosen by longest prefix match. A route to the peer's CIDR through the peering connection is more specific than a broad route to the TGW, so the peering connection wins. Verify this in your route tables rather than assuming it.
Other alternatives apply when only one service needs to be shared. AWS PrivateLink exposes a single service to many consumers without full network connectivity. It charges hourly per endpoint per AZ and per GB processed, so it suits a narrow interface better than broad VPC-to-VPC traffic.
Common mistakes
- Attaching every VPC to TGW by default. Low-traffic pairs would be cheaper to peer, and unused attachments bill continuously.
- Ignoring AZ placement. Peering saves nothing on cross-AZ traffic. Consumers and producers in the same AZ ID pay nothing.
- Forgetting cross-region peering is not free. Inter-region transfer rates apply in each direction of traffic that leaves a region.
- Stacking TGW and NAT processing for internet-bound traffic without checking volume.
- Comparing AZ names across accounts.
us-east-1ain one account may be a different physical zone fromus-east-1ain another. Use AZ IDs.
Decision guide
- Two or three VPCs, high traffic: peer them and keep the heavy talkers in the same AZ.
- Many VPCs, moderate traffic, shared services or inspection: use TGW.
- Many VPCs with a few heavy pairs: TGW plus targeted peering.
- One service shared with many consumers: consider PrivateLink.
- Cross-region needs: compare TGW inter-region peering against VPC peering. Both pay inter-region transfer, and TGW adds attachment and processing fees.
Exercise
You have 4 VPCs in one region exchanging 10 TB per month in total (10,240 GB). Assume all traffic crosses AZs. Using $0.05 per attachment-hour, 730 hours per month, $0.02 per GB TGW processing, and $0.02 per GB combined inter-AZ cost for peering, which option is cheaper, and by how much? How many peering links would a full mesh need?
Show answer
TGW costs 4 x $0.05 x 730 = $146 for attachments, plus 10,240 x $0.02 = $204.80 for processing, for a total of $350.80. Peering costs 10,240 x $0.02 = $204.80 because all traffic crosses AZs. Peering is cheaper by $146 per month. A full mesh needs 4 x 3 / 2 = 6 links.
Exercise
Why can peering be free for some traffic while TGW never is, and what should you change to move peering traffic toward free?
Show answer
Peering adds no fee of its own, so only the underlying data transfer path is charged, and same-AZ traffic is free. TGW always charges a per-GB processing fee plus attachment hours. To reduce peering cost, place the communicating workloads in the same AZ, identified by AZ ID, so traffic does not cross AZs.