In AWS, a Virtual Private Cloud (VPC) is a private network for your resources. When you create a new account, a default VPC is created automatically. But it’s a best practice to use a custom VPC for your resources, which means you can end up with multiple VPCs. So how can they talk to each other?

In this hands-on tutorial, I’ll walk you through how to peer two VCPs, which essentially lets them act as a single network, with EC2 instances being able to communicate across VPCs. We’ll start by creating an EC2 instance in each VPC, then creating a peering connection between the two, and finally updating the route tables for each VPC.

If you want to use the User Data script to create an HTML page on the EC2 instances, check out the script here: https://docs.google.com/document/d/1s8iNjZkDwq42fnpM-AeE27F1FEtbRYP24RicUi0VIbk/edit?usp=sharing

? Related videos you might find helpful:
– How to create a VPC, subnets and internet gateway in AWS: https://youtu.be/HbTfONoekyM
– How IP addressing and CIDRs work in AWS: https://youtu.be/kRDtwr1dPpw

??If you’re interested in getting AWS certifications, check out these full courses. They include lots of hands-on demos, quizzes and full practice exams. Use FRIENDS10 for a 10% discount!
– AWS Certified Cloud Practitioner: https://academy.zerotomastery.io/a/aff_n20ghyn4/external?affcode=441520_lm7gzk-d
– AWS Certified Solutions Architect Associate: https://academy.zerotomastery.io/a/aff_464yrtnn/external?affcode=441520_lm7gzk-d

00:00 – What is VPC peering in AWS and why would you use it?
02:33 – Creating an EC2 instance in each VPC
06:02 – Testing the connection between instances in two VPCs
07:45 – Creating a new VPC peering connection and accepting the request
09:14 – Modifying the route tables for the VPC peering connection
11:53 – Testing the updated connection between the two VPCs
12:18 – IMPORTANT! Delete your resources!

Similar Posts