nodemethod
ConnectivityFoundational

VPC peering for a small number of networks

Direct, low-latency links between two or three VPCs. Simple, but it does not route transitively.

A peering connection joins two virtual networks so they route to each other over the provider backbone with no extra hop. It is the cheapest and lowest-latency option, which makes it a good fit for a handful of networks. Because peering is not transitive, every pair that needs to talk needs its own connection, and the number of links grows quickly.

VPC A · 10.16.0.0/16VPC B · 10.17.0.0/16VPC C · 10.18.0.0/16pcx-abpcx-bcno route: not transitiveAPPAPI serviceprivate subnetRTRoute table10.17/16 → pcx-abDBShared cacheprivate subnetRTRoute table10.16/16 → pcx-abAPPReportingprivate subnetRTRoute table10.17/16 → pcx-bc
traffictunnel / replicationblocked

When to use it

  • Two or three VPCs that need private connectivity
  • Latency-sensitive traffic between a pair of networks
  • Sharing one services VPC with a single consumer

When to avoid it

  • More than three networks that all need to reach each other
  • When you need central inspection of traffic between networks

How traffic flows

  1. Create the peering connection from one VPC and accept it in the other (accounts and regions may differ).
  2. Add a route in each side's route tables pointing the other VPC's range at the peering connection.
  3. Allow the traffic in security groups. Cross-VPC security group references work within a region.
  4. VPC A cannot reach VPC C through B. If A needs C, create a third peering, or move to a transit hub.

Configuration examples

resource "aws_vpc_peering_connection" "ab" {
  vpc_id      = aws_vpc.a.id
  peer_vpc_id = aws_vpc.b.id
  auto_accept = true                      # same account and region
  tags = { Name = "a-to-b" }
}

resource "aws_route" "a_to_b" {
  for_each                  = toset(module.vpc_a.private_route_table_ids)
  route_table_id            = each.value
  destination_cidr_block    = aws_vpc.b.cidr_block
  vpc_peering_connection_id = aws_vpc_peering_connection.ab.id
}

resource "aws_route" "b_to_a" {
  for_each                  = toset(module.vpc_b.private_route_table_ids)
  route_table_id            = each.value
  destination_cidr_block    = aws_vpc.a.cidr_block
  vpc_peering_connection_id = aws_vpc_peering_connection.ab.id
}

Examples are starting points. Review provider limits, names and versions for your environment before applying.

What to monitor

SignalWhy it matters
Peering connection stateA deleted or expired peering drops traffic with no error in the application.
Route table coverageA missing return route is the most common cause of one-way traffic.
Cross-zone and cross-region data transferPeering is cheap per hour but data transfer is billed per GB.

Common failure modes

Asymmetric routes

A route exists in one direction only, so TCP handshakes time out.

Pulse sees SYN without SYN-ACK in flow logs and points at the missing route.

Expecting transitive routing

Traffic from A to C via B is dropped silently.

Sentinel maps reachability and shows which pairs have no path.

Checklist

0 of 5 done
Was this pattern useful?

Run this pattern with NodeMethod watching it.

NodeMethod is onboarding early-access teams now. Tell us about your environment and we will be in touch.

esc
↑↓ to move↵ to open