VPC peering allows you to connect 2 VPCs, much like a VPN tunnel allows for traffic between two sites in traditional, on-prem networking.
We’ll go through the setup for VPC peering…
For our lab setup, there are 2 VPCs- VPC1 and VPC2, which we’ll be peering together.
Note that the IP address space DOESN’T overlap.
We’ve got 1 subnet in each VPC:
From the VPC Dashboard, we’ll select Peering Connections > Create Peering Connection.
We’ll specify VPC1 as our Requestor and VPC2 as the Acceptor. This is more of an important step when the Acceptor VPC is in another account.
You’ll then see that the Status on the Peering connection is Pending Acceptance.
Since these are both in the same account, we’ll go to Actions > Accept Request
After this, the Peering is active. But we still need to create some routes.
For VPC1’s routing table, we’ll put VPC2’s subnet with the Peering Connection as the target.
Then, we’ll do the same for VP2:
To test, we’ll launch a Windows 2 Instance in each VPC.
After updating the security groups to allow traffic from the other subnets, we’ll ping to test connectivity.
And that’s it!