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

  1. Go to: AWS Console → VPC DashboardPeering Connections → Click “Create Peering Connection”.

  2. 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.

  3. Click “Create Peering Connection”.

Step 2: Accept the Peering Connection

  • Same account:

    1. In VPC → Peering Connections, select the new connection.

    2. Click “Actions → Accept Request”.

  • Different account:

    1. The owner of the Accepter VPC must log into their AWS account.

    2. Navigate to VPC → Peering Connections.

    3. Find the pending request and click “Accept Request”.

Step 3: Update Route Tables

You must allow traffic between VPCs by updating their route tables.

  1. Go to VPC → Route Tables.

  2. 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)

  1. Go to EC2 → Security Groups.

  2. 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

Login

To leave a reaction, you need to log in.