Connecting Two VPCs with VPC Peering
This lesson explains how VPC peering connects two VPCs privately over the AWS network, so resources in each communicate with private IP addresses as if they were in one network.
Learning outcomes
After completing this lesson, you will be able to:
- Describe how a peering connection is created and routed.
- Identify the limitations of peering, such as no transitive routing.
- Decide when peering is the best choice.
How peering works
A VPC peering connection links exactly two VPCs privately, in the same or different accounts and Regions. One VPC requests the connection and the other accepts it; both must then add routes to the other VPC's CIDR range through the peering connection, because peering creates no routes by itself. Security groups can reference security groups in a peered VPC in the same Region.
Traffic between peered VPCs stays on the AWS backbone network and is encrypted between Regions. There is no hourly charge, only data transfer, which is free within an Availability Zone and charged across zones and Regions. Peering is not transitive: if VPC A peers with B and B with C, A cannot reach C through B, and the CIDR ranges of peered VPCs must not overlap.
Peering facts
Limitations
VPC peering connects two VPCs, in the same or different accounts and Regions, so they communicate with private addresses. Its limitations often decide the correct exam answer. Peering is not transitive: if A is peered with B and B with C, A cannot reach C through B, so every pair that must communicate needs its own connection. The two VPCs' address ranges must not overlap, so overlapping networks cannot be peered at all.
There is also no edge-to-edge routing: a VPC cannot use its peer's internet gateway, NAT gateway, VPN connection or Direct Connect link, so peering cannot share a single path to the internet or to on premises. Finally, peering scales poorly: connecting n VPCs in a full mesh needs n × (n − 1) / 2 connections, 45 for ten VPCs, which is why larger networks use a transit gateway. The following table summarises the limitations.
| Limitation | Consequence |
|---|---|
| Not transitive | A peered with B and B with C does not connect A and C |
| No overlapping CIDRs | VPCs with overlapping ranges cannot peer |
| No edge-to-edge routing | A VPC cannot use its peer's internet gateway, NAT gateway, VPN or Direct Connect |
| Scales poorly | A full mesh of n VPCs needs n × (n − 1) / 2 connections |
The following diagram shows why peering is not transitive.

A full mesh
When to choose peering
Peering is the cheapest, lowest-latency option for connecting a few VPCs, or for high-volume traffic between two VPCs where Transit Gateway's per-GB processing charge would be significant. For many VPCs or shared on-premises connectivity, use Transit Gateway.
Two VPCs and a lot of data
An analytics VPC copies 200 TB a month from a data VPC in the same Region. The architect compares the options for connecting just these two VPCs.
| Option | Cost of the traffic |
|---|---|
| VPC peering | Data transfer only; free between instances in the same AZ |
| Transit Gateway | Data transfer plus a per-GB processing charge on all 200 TB |
Peering is cheaper for a single high-volume connection. The architect adds routes in both VPCs and allows the analytics security group in the data VPC's security group. If more VPCs need the data later, Transit Gateway becomes the better design.
VPC A is peered with B, and B with C. Can A reach C through B?
Show answer
No. Peering is not transitive, so A needs its own peering connection to C, or the VPCs need a Transit Gateway.
Exam Tips
Remember for the exam
- For a few VPCs at the lowest cost, use VPC peering.
- Peering is not transitive and cannot connect overlapping CIDRs.
- After creating a peering connection, add routes in both VPCs' route tables.
- A peered VPC cannot reach the internet or on premises through its peer's gateways.