ipdetecto.com logo
ipdetecto.com
My IPSpeed
Knowledge Hub
HomeKnowledge HubVpc Peering Routing Configurations
© 2026 ipdetecto.com
support@ipdetecto.comAboutContactPrivacyTermsllms.txt
Advanced
5 MIN READ
Apr 13, 2026

VPC Peering: Routing IPs Between Private Clouds

VPC Peering connects isolated cloud networks over AWS's internal backbone without traversing the public internet — but it requires precise route table configuration on both sides to work.

The Problem of Isolated Cloud Networks

Cloud providers give you complete network isolation by default. Each Virtual Private Cloud (VPC) is its own private address space, completely separated from all other VPCs even within the same account. Your database cluster in VPC-A and your application tier in VPC-B cannot communicate, period — until you deliberately connect them.

The naive solution is to give both services public IP addresses and route traffic over the internet. That approach is expensive, introduces latency, expands your attack surface, and forces you to encrypt all inter-service traffic carefully because it traverses public infrastructure. The correct solution is VPC Peering: a private network connection between two VPCs that routes traffic entirely through the cloud provider's internal backbone, bypassing the public internet completely.

This article covers how VPC Peering works at the routing level, how to configure it correctly, the common mistakes that break it, and when to use alternatives like AWS Transit Gateway instead.

How VPC Peering Works: The Routing Reality

A VPC Peering connection is not a tunnel and it is not a VPN. There is no VPN gateway, no encryption overhead, and no IPsec negotiation. A peering connection is simply an agreement between two VPC route tables that traffic destined for the remote VPC's CIDR range should go through the peering link rather than being dropped.

When you create a VPC Peering connection in AWS, you create a logical link between two VPCs. AWS assigns it a Peering Connection ID (format: pcx-xxxxxxxxxxxxxxxxx). However, the mere existence of this connection does not route any traffic. You must manually add route entries in each VPC's route tables pointing at the Peering Connection ID for the remote CIDR range. Forgetting this step is the single most common VPC Peering misconfiguration.

Additionally, security groups and network ACLs on both sides must explicitly permit the traffic you want to flow. A correctly configured route table entry that is blocked by a security group rule will still result in dropped connections. Both layers must be configured.

Step-by-Step Configuration

The configuration sequence for connecting VPC-A (10.1.0.0/16) to VPC-B (10.2.0.0/16) is:

  1. Create the peering connection: In the VPC console, initiate a peering request from VPC-A targeting VPC-B. If VPC-B is in a different account, you will need the account ID and VPC ID. VPC-B must accept the request.
  2. Update VPC-A's route table: Add a route: Destination 10.2.0.0/16, Target: the Peering Connection ID. This tells VPC-A that traffic for the 10.2.x.x range should go through the peering link.
  3. Update VPC-B's route table: Add a route: Destination 10.1.0.0/16, Target: the same Peering Connection ID. This tells VPC-B how to send return traffic back.
  4. Update security groups: On the resources in VPC-B you want to access, add inbound rules allowing traffic from 10.1.0.0/16 on the required ports. On resources in VPC-A initiating connections, ensure outbound rules permit traffic to 10.2.0.0/16.
  5. Update network ACLs if applicable: If you use network ACLs (stateless), you must add both inbound and outbound rules for the traffic and remember to account for ephemeral port ranges for return traffic.

Architecture Patterns

Simple Two-VPC Peering

The basic pattern: one peering connection between VPC-A and VPC-B. Suitable for connecting an application tier to a database tier, or a development VPC to a shared services VPC. Route configuration as described above. Security group rules locked down to the minimum required ports.

Hub-and-Spoke with a Shared Services VPC

Many organizations run a central "shared services" VPC containing DNS resolvers, monitoring agents, logging infrastructure, and security tooling. Individual application VPCs peer with this hub VPC. Each spoke VPC has one peering connection to the hub, and the hub has peering connections to all spokes.

The limitation: VPC Peering is non-transitive. If VPC-A peers with Hub and Hub peers with VPC-B, VPC-A cannot reach VPC-B through the hub. Traffic does not flow through peering connections. Each spoke can only reach the hub — spokes cannot reach each other via the hub without direct peering connections between them.

Full Mesh Peering

When every VPC needs to communicate with every other VPC, you need a full mesh: a peering connection between every pair of VPCs. For N VPCs, this requires N*(N-1)/2 peering connections. For 5 VPCs: 10 connections. For 10 VPCs: 45 connections. This becomes operationally unmanageable quickly and is why AWS Transit Gateway exists.

VPC Peering vs. Transit Gateway vs. PrivateLink

FeatureVPC PeeringAWS Transit GatewayAWS PrivateLink
Connection modelPoint-to-pointHub-and-spoke (managed)Service endpoint (one-directional)
Transitive routingNoYesN/A
Cross-accountYesYesYes
Cross-regionYes (inter-region peering)Yes (via TGW peering)No (regional only)
CIDR overlap handlingNot supportedNot supported nativelyWorks fine (uses DNS)
Cost modelData transfer cost onlyPer-hour + data processing feePer-hour + data processing fee
ScalabilityLimited (mesh complexity)High (thousands of VPCs)High (service-level)
Best forSimple, stable connectionsLarge multi-VPC environmentsExposing services to consumers

CIDR Overlap: The Fatal Constraint

VPC Peering has one hard requirement that causes significant architecture headaches: the CIDR ranges of peered VPCs must not overlap. You cannot peer a VPC using 10.0.0.0/16 with another VPC using 10.0.0.0/16 — there is no way for the route table to distinguish between the two networks.

This constraint forces disciplined IP address planning at the organizational level. Cloud architecture teams typically maintain an IP address management (IPAM) registry that assigns non-overlapping CIDR ranges to every VPC across all accounts and regions. AWS introduced AWS IPAM as a managed service to help with this. Without it, CIDR conflicts are common, especially when organizations grow through acquisition and merge cloud environments that were planned independently.

AWS PrivateLink sidesteps this constraint entirely by using DNS-based service endpoints rather than IP routing, making it preferable when CIDR ranges are not under your control.

Common Misconceptions About VPC Peering

Misconception 1: "Creating the peering connection is all you need to do"

The peering connection itself is just a logical construct — no traffic flows through it until you add matching route table entries on both sides. This is the most common configuration mistake. After creating a peering connection, always immediately check both route tables and verify the CIDR-to-pcx route entries are present. AWS will not warn you if you forget.

Misconception 2: "VPC Peering works like a VPN so traffic is encrypted"

VPC Peering does not add encryption. Traffic flows over AWS's internal network fabric, which is physically isolated from the public internet, but the packets themselves are not encrypted by the peering mechanism. If your compliance requirements mandate encryption in transit, you need to implement TLS at the application layer regardless of peering.

Misconception 3: "Peered VPCs can share internet gateways or NAT gateways"

This is explicitly not supported. Resources in VPC-A cannot reach the internet through VPC-B's internet gateway or NAT gateway, even if the peering connection is active and routes are configured. Each VPC must have its own internet gateway or NAT gateway for outbound internet access. Attempting to route internet traffic through a peered VPC results in dropped packets.

Misconception 4: "VPC Peering replaces all need for Transit Gateway"

VPC Peering is ideal for simple, stable connections between a small number of VPCs. Once you have more than 5-7 VPCs that need inter-connectivity, the number of peering connections and route table entries becomes operationally complex and error-prone. AWS Transit Gateway provides centralized management, transitive routing, and scales to thousands of VPCs — scenarios where maintaining a VPC Peering mesh is impractical.

Pro Tips for VPC Peering Configurations

  • Plan CIDR ranges before you deploy anything. Retroactively changing VPC CIDR ranges is painful — AWS added the ability to associate secondary CIDRs with a VPC, but primary CIDR ranges cannot be changed after creation. Use an IPAM tool or spreadsheet to track all assigned ranges across accounts and regions before creating any new VPC.
  • Use specific subnets in route tables rather than full VPC CIDRs when possible. Instead of routing all of 10.2.0.0/16 through the peering connection, route only the specific subnets that contain the resources you need access to. This limits blast radius if a routing error occurs and makes the intent explicit in the route table.
  • Tag peering connections with both VPC names and the purpose. In large environments with dozens of peering connections, untagged pcx IDs are meaningless. Always tag with something like Name: vpc-app-prod to vpc-db-prod and Purpose: app-to-database-connectivity.
  • Audit security groups regularly to avoid over-permissive rules. A common pattern is opening a security group to the entire peered VPC CIDR (10.2.0.0/16) when only connections from specific application servers are needed. Use the specific private IPs or security group references for source rules instead of broad CIDR ranges.
  • Use VPC Flow Logs on both sides to diagnose connectivity issues. When traffic is not flowing as expected, Flow Logs show whether packets are being accepted or rejected at each hop, making it straightforward to distinguish between a routing problem and a security group problem.
  • Consider PrivateLink for services you expose to external accounts. If you want to share a specific service (like an API or database endpoint) with partner accounts without giving them broad access to your VPC, PrivateLink exposes only that service as an endpoint DNS name, significantly limiting what the consuming account can reach.

Inspection, transitivity, and Transit Gateway trade-offs

Peering is non-transitive by design: spoke A cannot reach spoke C through a hub peer unless you hairpin routes and accept asymmetric paths. Centralized inspection VPCs often prefer Transit Gateway attachments with explicit route propagation tables so security appliances see both directions. Remember NACL vs security group statefulness when mixing peering with appliance subnets.

VPC Peering solves a fundamental cloud networking problem cleanly and cheaply for small topologies. Getting it right requires careful IP planning, disciplined route table management, and a clear understanding of its limitations — especially non-transitivity and the CIDR overlap constraint. Check your IP routing and network configuration here.

Frequently Asked Questions

Q.What is VPC Peering and how does it differ from a VPN?

VPC Peering is a private network connection between two cloud VPCs that routes traffic over the cloud provider's internal backbone. Unlike a VPN, there is no encryption overhead, no gateway appliance, and no tunnel negotiation — it is purely a routing construct that requires route table entries on both sides. Traffic stays off the public internet but is not encrypted by the peering mechanism itself.

Q.Do I need to update route tables after creating a VPC Peering connection?

Yes, and this is the most common mistake. Creating the peering connection only establishes the logical link — no traffic flows until you add route table entries in both VPCs pointing the remote CIDR range at the Peering Connection ID. You must update route tables on both sides for bidirectional traffic.

Q.Can two VPCs with overlapping CIDR ranges be peered?

No. VPC Peering requires that the CIDR ranges of both VPCs do not overlap. If both VPCs use 10.0.0.0/16, there is no way to create a valid routing entry that distinguishes between them, and AWS will reject the peering connection. This makes IP address planning critical before deploying VPC infrastructure.

Q.What is transitive routing and why doesn't VPC Peering support it?

Transitive routing means traffic can flow A to B to C through intermediate connections. VPC Peering is explicitly non-transitive: if VPC-A peers with VPC-B and VPC-B peers with VPC-C, VPC-A cannot reach VPC-C through VPC-B. Each VPC pair that needs to communicate requires its own direct peering connection. AWS Transit Gateway was built specifically to support transitive routing at scale.

Q.Can VPC Peering work across different AWS accounts?

Yes. Cross-account VPC Peering works the same as same-account peering with one difference: the receiving account must accept the peering request. The requester initiates with the target account ID and VPC ID, and an administrator in the target account approves it. Route tables and security groups must still be configured on both sides.

Q.Does VPC Peering work across AWS regions?

Yes, inter-region VPC Peering is supported and allows communication between VPCs in different AWS regions. The traffic still routes over AWS's internal network backbone rather than the public internet. Note that data transfer pricing for inter-region peering is higher than intra-region, and there are additional latency considerations depending on the regions involved.

Q.Can I access the internet through a peered VPC's NAT gateway?

No. AWS explicitly does not support routing internet traffic through a peered VPC's NAT gateway or internet gateway. If resources in VPC-A need internet access, VPC-A must have its own internet gateway or NAT gateway. Attempting to route internet traffic through peering results in dropped packets.

Q.When should I use Transit Gateway instead of VPC Peering?

Use Transit Gateway when you have more than 5-7 VPCs that need inter-connectivity, when you need transitive routing, or when you need centralized routing policy management. VPC Peering requires N*(N-1)/2 connections for full mesh between N VPCs, which becomes unmanageable quickly. Transit Gateway acts as a central hub and supports thousands of attachments.

Q.What is AWS PrivateLink and how is it different from VPC Peering?

PrivateLink exposes a specific service (not a whole VPC) as a private endpoint accessible via DNS. It does not require non-overlapping CIDRs and only exposes the specific service rather than full VPC access. It is best for sharing services with external accounts or customers while maintaining strict network boundaries. VPC Peering gives broader network-level access between VPCs.

Q.How do I troubleshoot VPC Peering connectivity issues?

Check in this order: confirm the peering connection status is Active, verify route table entries exist in both VPCs pointing the remote CIDR at the PCX ID, check security group inbound rules on the destination resource allow traffic from the source CIDR, and verify network ACLs permit the traffic in both directions. Enable VPC Flow Logs on both sides to see whether packets are being ACCEPT or REJECT at each point.

Q.Is data encrypted in transit over a VPC Peering connection?

VPC Peering does not add encryption — the traffic uses AWS's internal network fabric which is isolated from public internet, but packets are not encrypted by the peering mechanism. For compliance requirements mandating encryption in transit, implement TLS at the application layer regardless of whether VPC Peering is used.

Q.How many VPC Peering connections can one VPC have?

AWS allows up to 125 active VPC Peering connections per VPC by default, with route table limits of 50-1000 routes depending on the route table type. However, managing dozens of peering connections and their corresponding route table entries becomes operationally complex. For large environments, AWS Transit Gateway is the recommended approach.

Q.What is the cost of VPC Peering?

There is no hourly charge for a VPC Peering connection itself. You pay only for data transfer. Intra-region data transfer is typically free within the same Availability Zone and charged at standard rates across AZs. Inter-region peering data transfer is charged at the applicable regional data transfer rate.
TOPICS & TAGS
vpc peeringaws routingcloud architectureprivate cloudnetwork integrationaws vpc peeringgcp vpc peeringroute table configurationcidr overlap vpchub and spoke vpctransit gatewaycross account vpc peeringvpc peering vs transit gatewaycloud network security groupsunderstanding vpc peering and cloud routing 2026connecting separate private networks securely in the cloudupdating route tables for internal ip to ip trafficsecuring data travel between isolated virtual cloudsit guide to aws and gcp private network integrationbest practices for central hub and spoke vpc designavoiding public internet fees via private cloud peeringtechnical tutorial for cloud engineers and architects