AWS

Create an AWS VPC Peering Connection

aws

An AWS (Amazon Web Services) VPC (Virtual Private Cloud) peering connection is a networking connection between two VPCs that enables us to route traffic between them using private IPv4/IPv6 addresses. Instances in either VPC can communicate with each other as if they are within the same network. We can create a VPC peering connection between our own VPCs, or with a VPC in another AWS account. The VPCs can be in different regions (inter-region VPC peering connection).

VPC Peering Connection

Create VPC Peering Connection (Initiate from the Requester — VPC 1)

To initiate the VPC Peering from VPC 1 (for ex. London), we’ll follow these steps.

Step 1: Login to AWS Console.

Step 2: Search VPC from Services or we can find VPC in “Networking & Content Delivery” section.

Step 3: Go to VPC -> Peering Connection.

Step 4: Select “Create Peering Connection”.

Step 5: Provide a name tag to the Peering Connection.

Step 6: Select a local VPC (Requester) to peer with. (Local VPC to initiate the request), it’ll show us the CIDR Block associated with the local VPC.

Step 7: Select another VPC to peer with. Here, we can select a VPC from the same account or another account. We can also select from the same region and from another region (inter-region VPC Peering Connection) as well.

Step 8: Provide target VPC (Accepter) ID and click on Create Peering Connection.

Create Peering Connection

Now, we can see the Peering Connection is initiated and status is “Pending Acceptance”, we need to accept the request on destination VPC (VPC 2).

Peering Connection (Pending Acceptance)

Accept VPC Peering Connection (accept from the Accepter — VPC 2)

We can see the same status on Accepter VPC (VPC 2) as well.

Step 1: Select the pending VPC Peering Connection

Accept Request

Step 2: Select “Accept Request” and Accept Request confirmation comes.

Peering Request Confirmation

VPC Peering Connection is active

We can check that the status is now active on both VPCs.

Peering Connection Active Status

Some additional steps to complete the connection

We’ve completed the Peering Connection procedure but still, we need to follow some additional step to complete the connectivity between 2 VPCs.

Step 1: Create Routes on both ends.

On VPC 1, we need to provide CIDR for destination VPC (VPC 2) and target should be “Peering Connection”. Click on “Save routes”.

Adding Routes

On VPC 2, we need to provide CIDR for destination VPC (VPC 1) and target should be “Peering Connection”. Click on “Save routes”.

Step 2: Allow respective CIDR on the “Security Group” of particular service so that we can establish the connection to that service. I allowed CIDR on destination EC2 virtual machine’s Security Group.

Step3: Ping destination service (EC2) from source to check if everything is configured properly.

Thank you

AmritMatti

I’m the owner of “DevOpsTechy.online” and been in the industry for almost 5 years. What I’ve noticed particularly about the industry is that it reacts slowly to the rapidly changing world of technology. I’ve done my best to introduce new technology into the community with the hopes that more technology can be utilized to serve our customers. I’m going to educate and at times demonstrate that technology can help businesses innovate and thrive. Throwing in a little bit of fun and entertainment couldn’t hurt right?

AmritMatti

I’m the owner of “DevOpsTechy.online” and been in the industry for almost 5 years. What I’ve noticed particularly about the industry is that it reacts slowly to the rapidly changing world of technology. I’ve done my best to introduce new technology into the community with the hopes that more technology can be utilized to serve our customers. I’m going to educate and at times demonstrate that technology can help businesses innovate and thrive. Throwing in a little bit of fun and entertainment couldn’t hurt right?

View all posts by AmritMatti →

Leave a Reply

Your email address will not be published. Required fields are marked *