How create peering connection to connect two VPCs in AWS
Sometimes you need to connect two VPCs in AWS. In this article, I will explain how to implement that in four simple steps.
Step-by-Step Guide
Step 1: Create VPC Peering Connection
- Go to: AWS Console → VPC Dashboard → Peering Connections → Click “Create Peering Connection”.
Fill in the details:
- Name tag (optional): e.g., VPC-A-to-VPC-B.
- VPC Requester:
- Select the Requester VPC (your current VPC).
- VPC Accepter:
- Same account: Choose from dropdown.
- Another account: Enter Account ID and VPC ID manually.
Click “Create Peering Connection”.
Step 2: Accept the Peering Connection
Same account:
- In VPC → Peering Connections, select the new connection.
- Click “Actions → Accept Request”.
Different account:
- The owner of the Accepter VPC must log into their AWS account.
- Navigate to VPC → Peering Connections.
- Find the pending request and click “Accept Request”.
Step 3: Update Route TablesYou must allow traffic between VPCs by updating their route tables.
Go to VPC → Route Tables.
For each VPC:
- Select the relevant Route Table.
- Click “Routes” → Edit routes → Add route:
- Destination: The CIDR block of the peer VPC.
- Target: The Peering Connection ID.
- Click “Save routes”.
Repeat this for the other VPC’s route table.Step 4: Update Security Groups (Optional but likely needed)
Go to EC2 → Security Groups.
Edit the inbound rules to allow traffic from the CIDR of the peer VPC.
Example:
Type: All traffic (or specific port like HTTP, SSH)
Source: <peer VPC CIDR>
Do this on both sides.
Let me integrate VPCs for you. Get a free quote here.
Credits:
Image author:
Designed by stories / Freepik
Please login to leave a comment.