How to Create AWS VPC Peering Connection Step-by-Step

VPC peering allows you to connect two VPCs in the same or different AWS accounts. It operates over the AWS network backbone, ensuring low-latency and high-bandwidth communication between the peered VPCs.

When you create a VPC peering connection, you need to choose the “Requester VPC” and “Accepter VPC.” The requester initiates the peering request, while the accepter approves it. This bidirectional connection enables private IP address communication between instances in the peered VPCs.

Diagram showing VPC Peering setup on Amazon AWS

Regarding VPC peering in AWS cloud, there are several options and circumstances:

  • Two or more VPCs can be connected to one another within the same account.
  • Two or more VPCs in different AWS accounts can be connected.
  • You can establish peering relationships between VPCs in the same account across different AWS Regions.
  • You can establish peering relationships between VPCs in the different accounts across the same AWS Region.

Steps for creating VPC Peering in AWS

Step 1. Create two VPC

You need to have two VPCs. If you don’t have two VPCs then you can learn how to create VPCs here. As you can see I have my two VPCs. One is the requester VPC and another is the accepter VPC. (Just make sure that you use different, non-overlapping subnets for the 2 VPC.)

Screenshot showing two different VPC for creating VPC peering on AWS.

Step 2. Navigate to the VPC Dashboard

Open the Amazon VPC dashboard where you can manage VPC configurations.

Click on “Peering Connections” in the left-hand navigation pane.

Click the “Create Peering Connection” button.

Screenshot showing creating VPC Peering Connection

Type the name of the peering connection.

Select the Requester VPC from the dropdown menu.

Screenshot showing selecting Requester VPC

Also, select the Accepter VPC from the dropdown menu. (If you want to add an accepter from another region then click on “Another Region” or if the VPC is from another account click on “Another Account” and fill in the details required.)

Click on “Create peering connection.”

Screenshot showing selecting accepter VPC and Creating peering connection

Now you will see the message for connection request.

Screenshot showing success message for vpc-peering request

Step 3. Accepting the VPC Peering Request

Click on the Action Button and Select “Accept Request.” (If you have a different region and different account, switch to the respective VPC Peering Connection tab and Accept the request.)

Screenshot showing accepting the vpc-peering connection request

You will see the success message after that.

Screenshot showing success message of VPC peering

Copy the VPC peering id (i.e pcx-XXXXXX), we will need that later.

Step 4. Modify Route Tables of Requester and Accepter VPC

Click on  “Modify my route table now” from the success message box.

Screenshot showing modifying the route tables for the VPC peering connections in the AWS dashboard.

Select the Accepter VPC Route Table and Click on “Edit Routes.”

Screenshot showing editing the routes for the VPC connection

Now click on “Add route.”

In the “Designation” add the CIDR of Requester VPC and in the “Target” add the VPC Peering ID that we have copied from above.

Screenshot showing adding VPC peering connection 

Click on “Save Changes.”

Now also select the Requester VPC route table and add the CIDR of Accepter and VPC Peering ID as above. 

Step 5. Check the Peering Status

Return to the VPC Dashboard.

Verify that the peering status is “active.”

Step 6. Testing the connection

To test the connection I have created two instances, in Requester VPC and in Accepter VPC. Both of them have public and private IP. Then I will curl the accepter instance from the requester instance through the private IP of the accepter instance.

Screenshot showing requester VPC instance with Public IP