Scenario:
- Create the following vpcs
- Oregon:
- vpc : 192.168.0.0/23
- subnets:
- web: 192.168.0.0/24
- app: 192.168.1.0/24
- Mumbai:
- vpc: 192.168.2.0/23
- subnets
- db1: 192.168.2.0/24
- db2: 192.168.3.0/24
- Oregon:
- Create an ec2 instance in the web subnet of oregon vpc with public ip address enabled
- Create an ec2 instance in the db1 subnet of mumbai vpc with no public ip
- The scenario is to establish a private connectivity b/w two vpcs
- In AWS to establish private connectivity b/w two vpcs we need to use vpc peering. So lets establish a peering connection b/w oregon vpc and mumbai vpc
- Make a note of vpc ids
mumbai: vpc-0761b59a078866a89
oregon: vpc-04f0d209a5b7b0a49
- When we create a peering connection a request will be sent to the vpc to which we have requested a peering connection.
- Now lets go to the mumbai region and look into peering request
- Peering connection can be set b/w any two vpc whose ip ranges dont collide
- When we accept this request a peering connection object is created in the vpcs
- So now we need to modify route tables to forward the traffic to peering connection objects when the destination is the other cidr range
- Now lets login into oregon ec2 instance and check the private connectivity b/w oregon ec2 and mumbai ec2
- Note: We have enabled the ssh connectivity, now by adjusting security groups and nacl you can enable any tcp/udp/icmp connectivity privately b/w two vpcs
- pricing of peering Refer Here
Next Steps:
- How to establish p/w connectivity b/w on-premises and AWS VPC
