AWS Networking Contd…..
VPC Peering
- VPC Peering enables private network connectivity between two vpcs in aws(irrespective of regions, accounts).
- The only condition is cidrs should not collide/overlap
- Create a VPC in mumbai region with two subnets (192.168.0.0/23)
- web (192.168.0.0/24)
- db (192.168.1.0/24)
- Create a VPC in oregon region with two subnets (172.16.0.0/23)
- web (172.16.0.0/24)
- db (172.16.1.0/24)
- Create an ec2 instance with public ip address in web subnet of mumbai region
-
Create an ec2 instance without public ip in the db subnet of oregon region
-
Oregon VPC
- Mumbai VPC
- For the public ip to work in mumbai, we need an internet gateway attached.
- Lets also create a public route table and private route table in mumbai region. web being public subnet and db being private subnet
- Now lets create a security group for the ec2 instance which allows
- 22 from any where (ssh)
- icmp from anywhere (ping)
- Now lets create an ec2 instance in mumbai with public ip
- In the oregon region, i will not be creating the internet gateway
- Lets launch an ec2 instance in db subnet with no public ip
- Now lets login into mumbai ec2 from your system
- The private connectivity is not working as there is no VPC Peering
-
Lets create a peering request and configure the route tables
- At this point we createdd a request for peering connection from mumbai to oregon. Oregon vpc has to accept the request
- Lets modify oregons default route table and forward the packaets with destination 192.168.0.0/23 to the peering connection object
- NOw navigate to the mumbai region and add routes for private cidr rnage
- Overview of the peering connection