Skip to Content

VPC peering

VPC peering for private connections between two VPCs, the no-overlap and no-transitivity rules, route tables, cross-account and cross-Region peering, and referencing security groups.

What it is

VPC peering is not transitive: VPC A is peered with VPC B and with VPC C, but B and C can't talk through A; B and C need their own peering connection, and every VPC needs non-overlapping CIDRs and routes in its route tables VPC peering is not transitive: VPC A is peered with VPC B and with VPC C, but B and C can't talk through A; B and C need their own peering connection, and every VPC needs non-overlapping CIDRs and routes in its route tables

Every pair that must talk needs its own peering.

VPC peering privately connects two VPCs using AWS's network.

  • Makes them behave as if they were in the same network.
  • They must not have overlapping CIDRs.
  • A VPC peering connection is NOT transitive: it must be established for each pair of VPCs that need to communicate.
  • The route tables in each VPC's subnets must be updated so EC2 instances can communicate (route the peer's CIDR to the peering connection pcx-…).

Good to know

  • A VPC peering connection can be created between VPCs in different AWS accounts and Regions (inter-Region traffic is encrypted and stays on the AWS backbone).
  • Rules can reference a security group in a peered VPC as a source or destination (it works cross-account, but only in the same Region): for example, source 123456789012/sg-027ad1f7865d4be76.
  • For a peered VPC in a different Region, use its CIDR in security group rules instead.
  • No bandwidth bottleneck or single point of failure: peering isn't a gateway.

Real-world examples

  • A shared-services VPC (Active Directory, monitoring) is peered with three application VPCs. The application VPCs can't talk to each other through it, which is exactly what the security team wants.

Exam tips

  • "Connect two VPCs privately" → VPC peering (with route table updates).
  • "VPC A peered with B and C; B can't reach C" → peering isn't transitive; peer B and C, or use Transit Gateway.
  • "Peering fails to create" → overlapping CIDRs.
  • "Many VPCs (dozens or more)" → Transit Gateway instead of a mesh of peerings.

Common traps

  • "Peering works without route changes." Both sides need routes.
  • "Reference a security group from a peered VPC in another Region." Same Region only; use CIDRs across Regions.

Check yourself

Peering two VPCs is free (cross-AZ or cross-Region data is billed), but needs instances to test, so instead:

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt