Create VPC Peering Connection using AWS Console
What is VPC Peering Connection ?
- Amazon Virtual Private Cloud (VPC) peering connection is a networking connection that enables you to route traffic between two VPCs using private IP addresses.
- You can create a VPC Peering between –
1. Your VPC with other VPC in same region.
2. Your VPC with other VPC in different region. (also known as inter-region VPC peering connection)
3. Your VPC with other VPC in another AWS account.
- A VPC peering connection allows you to route traffic between the peer VPCs using private IP addresses as if they are part of the same network.
Now let us see how we can create a VPC peering connection . Here we will create peering connection of VPCs that are in different regions .
Steps to Create VPC Peering Connection –
- Create two VPCs in two different regions. ( Follow steps given here to create a VPC – Create custom VPC in AWS ) . I have created two VPCs – one in Oregon region and another in Virginia region.
- Now, in any one of the above two regions , go to the VPC service and click on Peering Connection option in the left . In that, click on Create Peering Connection button .
- Fill in the details to create peering . Select any one VPC we created in VPC(Requester) and enter the VPC ID of another VPC we created in other region in VPC(Accepter) .
Account we have to select as My Account and Region as Another Region as our VPCs are in different regions.
Click on Create Peering Connection button and confirm the details of your VPC and the VPC to be peered with.
- Accept the VPC peering request which will receive in another region i.e Oregon .
- Now, most important part is we have to add the routes of first VPC into the route table of other VPC and vice versa. So both the VPCs route table will have routing details of each other.
- Finally, we have to check both VPC’s peering connection . Create atleast 2 instances one in each VPC. ( Note – make atleast one instance as public to connect it from internet and rest/other instance in another VPC as private which we will connect using peering connection)
Also, check the security group to make sure we have SSH and ICMP perts are open for instances in both VPCs.