What is VPC Peering?

It is a networking connections using which you can communicate between the resources in the VPC’s.

It is used to route the traffic between two VPC’s using IPv4 or IPv6 addresses.

vpc

If you enable peering between two VPC , The resources created in each VPC will be able to communicate between each other by thinking that they are logically present in the same VPC.

Multiple Ways of VPC Peering

  • VPC peering can be created in the Same AWS Account.
  • VPC peering can be created with the VPC in the Another AWS Account.
  • VPC peering – VPC’s in different AWS Regions.

Steps Involved in VPC peering

  • To Create a VPC peering connection , The owner of the requester VPC sends a requests to the Owner of the Acceptor VPC , The VPC CIDR block should not overlap between each other.
  • To activate the VPC peering , The Owner of the Acceptor VPC accepts the requests from the Owner of the Requestor VPC
  • To route IPv4 traffic between VPC’s route should be added to the route table of the VPC pointing the CIDR block of the VPC.
  • Check and Allow required ports in the Security group level which ensures that the traffic flow between the Instances are not blocked or restricted.

Creating VPC Peering Connection in Same AWS Region & Same AWS Account

Open AWS VPC Console

In the left navigation pane , Choose Peering Connections

Click Create Peering Connection , Provide a Name for the VPC peering connection.

Under Select a local VPC to peer with , Here We have to choose the requestor VPC.

In the drop down menu , Choose the VPC.

Under Select another VPC to peer with ,

For Account , Choose My account , As we are going to create a VPC peering connection in the same AWS account and the same AWS region.

For Region , Choose This region.

For the Acceptor VPC , In the drop down menu , Choose the VPC.

Once you click OK , You will be provided with a VPC Peering Connection id.

if you check the status of the VPC peering connection , It will shows as Pending Acceptance.

To accept the request , Select the peering connection and Under Actions ,

Click Accept Request.

vpc

Once you Accept the peering connection , Another dialog appears asking us to modify the route table in order to send and receive the traffic between the VPC’s.

Now You can see the Status of the VPC peering connections as Active.

Creating Peering Connection in Different AWS Region & Same AWS Account

Open AWS VPC Console

In the left navigation pane , Choose Peering Connections

Click Create Peering Connection , Provide a Name for the VPC peering connection.

Under Select a local VPC to peer with , Here We have to choose the requestor VPC.

In the drop down menu , Choose the VPC.

Under Select another VPC to peer with ,

For Account , Choose My account , As we are going to create a VPC peering connection in the same AWS account and with the different AWS region.

For Region , Choose Another region , In the drop down menu , Choose the destination region where the target VPC resides.

vpc

For the Acceptor VPC , In the drop down menu , Choose the VPC.

Once you click OK , You will be provided with a VPC Peering Connection id.

if you check the status of the VPC peering connection , It will shows as Pending Acceptance.

To accept the request , Select the peering connection and Under Actions ,

Click Accept Request.

vpc

Once you Accept the peering connection , Another dialog appears asking us to modify the route table in order to send and receive the traffic between the VPC’s.

Now You can see the Status of the VPC peering connections as Active.

Creating Peering Connection in Same AWS Region with Different AWS Account

Here We are going to create a peering requests with the VPC in the Another AWS Account.

You need Account Number and VPC ID of the target account.

Open AWS VPC Console

In the left navigation pane , Choose Peering Connections

Click Create Peering Connection , Provide a Name for the VPC peering connection.

Under Select a local VPC to peer with , Here We have to choose the requestor VPC.

In the drop down menu , Choose the VPC.

Under Select another VPC to peer with ,

For Account , Choose Another account ,

For Region , Choose This region , In the drop down menu ,

vpc

For the Acceptor VPC , In the drop down menu , Choose the VPC.

Once you click OK , You will be provided with a VPC Peering Connection id.

if you check the status of the VPC peering connection , It will shows as Pending Acceptance.

To accept the request , Select the peering connection and Under Actions ,

Click Accept Request.

vpc

Once you Accept the peering connection , Another dialog appears asking us to modify the route table in order to send and receive the traffic between the VPC’s.

Now You can see the Status of the VPC peering connections as Active.

Creating Peering Connection in Different AWS Region with Different AWS Account

Here We are going to create a peering requests with the VPC in the Another AWS Account.

You need Account Number and VPC ID of the target account.

Open AWS VPC Console

In the left navigation pane , Choose Peering Connections

Click Create Peering Connection , Provide a Name for the VPC peering connection.

Under Select a local VPC to peer with , Here We have to choose the requestor VPC.

In the drop down menu , Choose the VPC.

Under Select another VPC to peer with ,

For Account , Choose Another account ,

For Region , Choose Another region , In the drop down menu , Choose the destination region.

vpc

For the Acceptor VPC , In the drop down menu , Choose the VPC.

Once you click OK , You will be provided with a VPC Peering Connection id.

if you check the status of the VPC peering connection , It will shows as Pending Acceptance.

To accept the request , Select the peering connection and Under Actions ,

Click Accept Request.

vpc

Once you Accept the peering connection , Another dialog appears asking us to modify the route table in order to send and receive the traffic between the VPC’s.

Now You can see the Status of the VPC peering connections as Active.

Conclusion

We have successfully learnt how to configure VPC peering to establish connection between the VPC’s in multiple ways as discussed above.

Hope this article helps , Thanks for reading this article.

Please do check out my other publications.