Create two instances in two different vpc in same region and make them to ping to each other over internal ip(local ip)
step1: Create Two VPC, one is Privpc and another is Pubvpc.
step2: Now create two subnet, one is Pubsub and another is Prisub.
step5: Now, create two Internet Gateway, one is pubigw and another is priigw. Then, Attach pubigw with pubvpc and priigw with priVPC.
In private instance configure : vpc -- privpc, subnet -- prisub, security group -- prisecgrp.
step8: Now, Go back to VPC dashboard and click on peering connection from the left hand side panel.
Here, give name pubpeer. Then slecte local VPC to peer with in first VPC ID select pubvpc and select another VPC to peer with in second VPC ID select priVPC and then click on create peering connection.
step9: Now, go back to route tables, and select one route pubRT and then select below route and click on button edit routes in right hand side below corner.
step10: Now, in Edit routes section click on Add route button and then click on target search box and select internet gateway and choose pubigw and enter destination 0.0.0.0/0 which i hilighted in yellow color.
Then, click on Add route button again and click on target serach box and select peering connection pubpeer and HERE make sure give correct destination if you doing this edit route for pubRT then enter destination of prisub (subnet) CIDR IP which you gave when created subnet.
Same repeat these steps for priRT but just select internet gateway as priigw and in peer connection enter destinantion pubsub (subnet) CIDR IP which you gave when ctreated subnet.
step11: Now all steps done go back to EC2 instance page and connect first public instance and once it should be connect copy private ip of Private instance. Then enter the command ping and paste the private ip of private insatnce like this command: ping 172.0.0.38.
Now same like connect private instance this time and once it should be connect ping ip of public instance private ip.
You will see same type of output in both instance when you connect and ping each other private IPs.
Thank you.












Comments
Post a Comment