How to setup peering connection between 2 VPCs in AWS

A peering connection lets resources (e.g. EC2 instances) in one VPC to communicate/connect to resources on another VPC.

This is my Osaka VPC, network is 10.18.0.0/16

This is my Seoul VPC, network is 10.17.0.0/16

Once a peering connection is made, we need to make adjustments to the route tables in both Osaka and Seoul, so each VPC knows how to reach each other.

Create a peering connection
In Osaka, accept the peering connection request
In the Seoul VPC route table, add a route entry to 10.18.0.0/16 (which is Osaka’s network) via the peering connection we just created
In Osaka VPC route table, add a route entry to Seoul’s network via the peering connection we just created
I have these instances in Osaka, note they are in public subnet (i.e. AZ) a and b
And these instances in Seoul, 1 set is in private subnets, another set in public subnets

Observation

Green line means can connect, red means timed out. What’s surprisingly unexpected was from Osaka I can’t connect to the instances in Seoul’s private subnets and vice versa.

What about CloudShell in Osaka, can it connect to instances in Seoul? What about CloudShell in Seoul, can it connect to instances in Osaka?

Irrelevant, because CloudShell uses public IP addresses, so connections do not pass through the peering connection.

Leave a Reply

Your email address will not be published. Required fields are marked *