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.
- Detect
- Analyze
- Resolve
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
- Create the peering connection from one VPC and accept it in the other (accounts and regions may differ).
- Add a route in each side's route tables pointing the other VPC's range at the peering connection.
- Allow the traffic in security groups. Cross-VPC security group references work within a region.
- 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
}Full mesh links = n × (n − 1) / 2
VPCs peering links
3 3
5 10
10 45
20 190 ← move to a transit hub long before thisExamples are starting points. Review provider limits, names and versions for your environment before applying.
What to monitor
| Signal | Why it matters |
|---|---|
| Peering connection state | A deleted or expired peering drops traffic with no error in the application. |
| Route table coverage | A missing return route is the most common cause of one-way traffic. |
| Cross-zone and cross-region data transfer | Peering 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.