In this blog, we will show you the steps to create a VPC peering connection in the AWS environment.
- For the demo purpose, we are connecting two VPC’s between Mumbai and Singapore. In the Mumbai region, we create a VPC with two subnets in a different availability zone.
- Also, we create a windows instance in this VPC.
- In the Singapore region, we created two subnets in a different availability zone.
- We create a windows VM in Singapore region to test the connectivity between two regions.
CREATING VPC PEERING CONNECTION FROM MUMBAI REGION
- Open the services window and search for VPC.
- Under virtual private cloud, click on peering connections.
- Click on create peering connection button.
- Provide a name for the peering connection and select the local VPC from the drop-down list.
- We have created the two different region VPC’s under same AWS account. So we select the Account as My account and Region as Another region and select Singapore from the drop-down list.
- Provide the Singapore region VPC ID in the VPC accepter and click on create peering connection.
ACCEPTING CONNECTION FROM SINGAPORE REGION
- Go to Singapore Region, and open the VPC dashboard and click on Peer connection. Then accept the VPC peering request.
- Click on the Yes, Accept button.
- VPC peering connection has been established successfully.
UPDATING THE ROUTING TABLES IN MUMBAI REGION
- Go to Mumbai region and access VPC dashboard. Click on Routing tables link.
- Select the subnet and click on Routes Tab.
- Then click on edit routes.
- Add the new route entry for Singapore VPC Network range. We use 126.96.36.199/16 range as VPC network in Singapore region. Also, select the peering connection as a target from the drop-down list and click save routes.
UPDATING THE ROUTING TABLES IN SINGAPORE REGION
- Now, add the Mumbai region VPC network in Singapore Routing Table. We use 10.0.0.0/16 range as VPC network in Mumbai region.
- We will test the connectivity between these two regions using the ping command. We are able to ping the server each other without any issue.
- Please make sure that you have added the corresponding rule for ping is security group before performing the testing.
Thanks for reading this blog. We hope it was useful for you to learn about configuring VPC peering in the AWS environment.