Home Blog About Contact AWS Artificial Intelligence
AWS Beginner

AWS VPC Peering Configuration

What is VPC Peering? A networking link that allows you to route traffic between two VPCs using private IPv4 or IPv6 addresses is called a VPC peering connection.  Instances in either VPC…

WWWordWyzz ·Published Feb 15, 2024 ·Updated Aug 8, 2026 ·3 min read ·151 views

What is VPC Peering?

A networking link that allows you to route traffic between two VPCs using private IPv4 or IPv6 addresses is called a VPC peering connection. 

Instances in either VPC can communicate with each other as if they are within the same network.

You can create a VPC peering connection between your own VPCs, or with a VPC in another AWS account.The VPCs can be in different Regions (also known as an inter-Region VPC peering connection).

Diagram of a VPC peering connection linking two VPCs so their instances communicate over private IP addresses.

Here are some key points about VPC peering

  • Interconnection: VPC peering allows VPC instances to communicate with each other using private IP addresses. This communication takes place over the internal network of the cloud provider, avoiding exposure to the public internet.
  • Isolation: Despite the interconnectedness provided by VPC peering, each VPC retains its own network configuration, security settings, and control over resources. This means that VPCs can communicate securely while remaining isolated from each other’s configurations.
  • Transitive Peering: Some cloud providers support transitive peering, which allows VPCs to establish peering connections with other VPCs indirectly. For example, if VPC A is peered with VPC B, and VPC B is peered with VPC C, then VPC A can communicate with VPC C through VPC B.
  • Limitations: There might be limitations on VPC peering configurations imposed by the cloud provider, such as restrictions on overlapping IP address ranges or limitations on the number of peering connections allowed per VPC.
  • Use Cases: VPC peering is commonly used for scenarios where different applications or services hosted in separate VPCs need to communicate with each other privately. This can include scenarios like microservices architectures, multi-tier applications, or separating development, testing, and production environments.

The cost of a VPC peering connection

Establishing a VPC peering connection is free of cost. When a VPC Peering connection remains inside an Availability Zone (AZ), all data transfer is free. Transfer of data across Availability Zones and Regions via VPC Peering connections is subject to costs.

Want to learn Hands-on on Application load balancer ?

Let’s check out practically

  • Step 1: Create two VPCs in your AWS Account
    • Creating VPC in Sydney Region
AWS VPC console in the Sydney region, beginning creation of the first VPC.
VPC creation form in the Sydney region with the name and IPv4 CIDR block entered.
  • Step 2: Create Public and Private subnets
Subnets dashboard in the AWS VPC console before adding the public and private subnets.
Creating the public subnet in the Sydney VPC with its Availability Zone and CIDR range.
Creating the private subnet in the Sydney VPC with its Availability Zone and CIDR range.
  • Step 3: Create Internet Gateway
Internet gateways dashboard in the AWS VPC console.

Attach to VPC after creating internet gateway

Attaching the newly created internet gateway to the Sydney VPC.
Confirmation that the internet gateway is attached to the Sydney VPC.
  • Step 4: Once Internet gateway is attached to VPC, Create Route Table
Creating the public route table for the Sydney VPC.

After creating Route Table, edit the subnet associations and add the routes

Subnet associations tab of the route table before the public subnet is associated.
Associating the public subnet with the public route table.

Public subnet is associated and now add the route to IGW

Adding a 0.0.0.0/0 route pointing at the internet gateway in the public route table.
  • Step 5: Create NAT Gateway and add private route table
    • NAT Gateway must be placed on public subnet and also allocate Elastic IP
Creating a NAT gateway in the public subnet with an allocated Elastic IP address.

Now create private route table, edit subnet associations and add route to NAT GW

Creating the private route table for the Sydney VPC.
Associating the private subnet with the private route table.
Adding a route through the NAT gateway in the private route table.
  • Resource Map
VPC resource map showing the subnets, route tables and gateways of the Sydney VPC.
  • Step 6: Launch Public and Private Servers (Using Ec2 )
Launching the public and private EC2 instances inside the Sydney VPC.
  • Step 7: Similarly as shown above create VPC, IGW, Public Route Table, NAT GW, Private Route table in Singapore region
  • Step 8: Also Create Public and Private Servers in Singapore Region( Using Ec2)
  • Step 9: Final step is to create VPC Peering Link
    • Initiate peering from any one side( Singapore Region), and accept the peering in another side (Sydney Region)
Creating the VPC peering connection from the Singapore region with the Sydney VPC as the accepter.
VPC peering connection showing Pending Acceptance status.

Go to Sydney Region and accept peering request

Accepting the pending VPC peering request from the Sydney region.

VPC peering is successfully created and active

VPC peering connection showing Active status once the request is accepted.
WW
Written by
WordWyzz
Cloud & AI Engineering

Hands-on guides to building production-ready cloud and AI systems on AWS — written by Raviteja Vishnubhotla, an AWS practitioner, for practitioners.

This Post Has One Comment

Leave a Reply