AWS - VPC Peering

 

A VPC peering connection is a one-to-one relationship between two VPCs. 

You can create multiple VPC peering connections for each VPC that you own, but transitive peering relationships are not supported.

Transitive peering means VPC-A is connecting to VPC-C via another VPC-B is not possible.

In short, VPC peering is a channel to establish a connection between 2 different VPC's.


I have 2 VPC's:

1) Default VPC - CIDR 172.31.0.0/16
2) Demo VPC - CIDR 10.0.0.0/16

We are going to create a VPC Peering between them and update the route table on both the VPC's accordingly.

For demo purpose, I have launched an ec2 instance on "Demo VPC" and setup an httpd server.

We are trying to access that httpd server from another ec2 instance launched on "Default VPC".


I get time out when I try to curl from the ec2 instance launched on "Default VPC" to the httpd service running on "Demo VPC".

Now, Let's create a peering connection. Under VPC, Select "Peering Connections".


We are creating a peering connection from "Default VPC" to "Demo VPC".



You need to accept the request for the connection request.

Once the peering connection is established. We need to modify the route table accordingly on both the VPC’s.


Route table of Default and Demo VPC after updating:




Thats it. Let's curl and see if it works.

Yay!!! It works.


Comments

Popular posts from this blog

SRE/DevOps Syllabus

AWS Code Commit - CI/CD Series Part 1

Docker - Preventing IP overlapping