AWS Builder Center

AWS VPC Peering Explained: My Hands-On Journey from Setup to Real-World Troubleshooting

Learn AWS VPC Peering through a practical, beginner-friendly project. Discover how to connect two Amazon VPCs privately, configure EC2 instances, manage route tables, understand Security Groups, and troubleshoot real-world connectivity issues. This hands-on guide shares practical lessons, common mistakes, and essential AWS networking concepts to help beginners build confidence in cloud computing.

AWS VPC Peering Explained: My Hands-On Journey from Setup to Real-World Troubleshooting
Introduction
When I started exploring Amazon Web Services (AWS), one of the concepts I wanted to understand practically was VPC Peering.
I knew that AWS allowed us to create isolated virtual networks, but I wanted to understand something more important:
How can two separate VPCs communicate securely using private IP addresses without sending traffic over the public internet?
To explore this concept, I worked on a hands-on AWS VPC Peering project.
In this article, I'll explain VPC Peering, its architecture, configuration steps, EC2 connectivity, and some important troubleshooting lessons.
My goal is to make AWS networking easier for beginners through practical explanations.
1. Understanding Amazon VPC
Amazon Virtual Private Cloud (Amazon VPC) allows users to create an isolated virtual network within AWS.
Think of a VPC as your own private network in the cloud.
It provides networking components such as:
- Subnets - Route tables - Security Groups - Network ACLs - Internet Gateways - EC2 instances
Organizations can use separate VPCs for different applications, environments, or departments.
However, sometimes resources in different VPCs need to communicate. This is where VPC Peering becomes useful.
2. What is VPC Peering?
VPC Peering is a networking connection between two VPCs that allows resources to communicate using private IP addresses.
It supports connections between VPCs:
- Within the same AWS account. - Across different AWS accounts. - Within the same AWS Region. - Across different AWS Regions.
VPC Peering uses AWS infrastructure to facilitate private communication rather than routing traffic over the public internet.
An important requirement is that the VPCs must have non-overlapping IPv4 CIDR ranges.
For example:
- VPC A: 10.0.0.0/16 - VPC B: 10.1.0.0/16
3. Understanding the Architecture
For a basic VPC Peering project, we need:
- Two separate VPCs. - One subnet in each VPC. - One EC2 instance in each subnet. - A VPC Peering connection. - Properly configured route tables. - Appropriate security rules.
The communication flow looks like this:
EC2 Instance A → VPC A → VPC Peering Connection → VPC B → EC2 Instance B.
This architecture helps us understand how private communication works between isolated cloud networks.
4. Step-by-Step Implementation
Step 1: Create Two VPCs
Open the AWS Management Console.
Navigate to:
VPC → Your VPCs → Create VPC.
Create two VPCs with different CIDR ranges.
Example:
VPC A: 10.0.0.0/16
VPC B: 10.1.0.0/16
Step 2: Create Subnets
Create one subnet inside each VPC.
Example:
- VPC A subnet: 10.0.1.0/24 - VPC B subnet: 10.1.1.0/24
Subnets help organize cloud resources within a VPC.
Step 3: Launch EC2 Instances
Launch one EC2 instance in each subnet.
Amazon Linux is a suitable operating system for this demonstration.
Make sure each EC2 instance is launched in the correct VPC and subnet.
Step 4: Create a VPC Peering Connection
Navigate to:
VPC → Peering Connections → Create Peering Connection.
Select:
- Requester VPC: VPC A - Accepter VPC: VPC B
Create the peering connection.
If necessary, accept the request from the accepter VPC.
Once accepted, check that the connection status becomes Active.
Remember: Active status only confirms that the peering connection is established. It does not automatically guarantee connectivity between EC2 instances.
Step 5: Configure Route Tables
This is one of the most important steps.
Both VPCs need appropriate routes.
For VPC A:
Destination: 10.1.0.0/16
Target: VPC Peering Connection
For VPC B:
Destination: 10.0.0.0/16
Target: VPC Peering Connection
Make sure you update the route tables associated with the subnets containing your EC2 instances.
Without the correct return route, communication may fail.
Step 6: Configure Security Groups
Security Groups act as virtual firewalls for EC2 instances.
They control which inbound and outbound connections are allowed.
For SSH connectivity testing:
- Protocol: TCP - Port: 22 - Source: Appropriate private IP or CIDR range of the remote instance.
For ping testing, configure the required ICMP rules separately.
Always follow the principle of least privilege. Avoid allowing all traffic from everywhere.
Step 7: Verify Network ACLs
Network ACLs provide another security layer at the subnet level.
Check whether they allow the required inbound and outbound traffic.
Remember that Network ACLs are stateless, meaning return traffic must also be explicitly permitted.
5. Testing Connectivity
After configuring the peering connection, route tables, and security rules, test communication.
Connect to your source EC2 instance.
For SSH port testing:
nc -zv <destination-private-ip> 22
For ICMP testing:
ping <destination-private-ip>
Replace the placeholder with the actual private IP address.
An important observation is that successful TCP connectivity does not necessarily mean that ping will work.
Ping uses ICMP, while SSH uses TCP port 22. Their security rules and connectivity results can differ.
Therefore, always test the protocol that your application actually needs.
6. Troubleshooting: What I Learned
During my hands-on project, I learned that establishing a VPC Peering connection is only the beginning.
Even when the connection status is Active, connectivity problems can still occur.
For example, I observed a situation where TCP connectivity to port 22 worked for one application instance, while an ICMP test to another instance failed.
This helped me understand that different protocols require different configurations.
Here is my troubleshooting checklist:
1. Verify that the peering connection is Active. 2. Check that both VPCs have non-overlapping CIDR ranges. 3. Verify routes in both VPC route tables. 4. Confirm that the correct subnet route tables are associated. 5. Check Security Group inbound and outbound rules. 6. Verify Network ACL rules. 7. Confirm that the destination private IP is correct. 8. Ensure that the destination service is running.
AWS Reachability Analyzer can also help identify network configuration issues.
7. Important Limitations
Before using VPC Peering in real-world environments, understand these limitations:
- Overlapping IPv4 CIDR ranges are not supported. - VPC Peering does not support transitive routing. - A third VPC cannot automatically forward traffic between two other peered VPCs. - Route tables must be configured appropriately. - Security Groups and Network ACLs must permit the intended traffic.
For larger network architectures involving multiple VPCs, AWS Transit Gateway may be a more suitable solution.
8. Key Takeaways
This project helped me understand several important AWS networking concepts:
- How Amazon VPC works. - How private IP communication works. - Why route tables are important. - The difference between Security Groups and Network ACLs. - Why bidirectional routing matters. - How to troubleshoot connectivity issues.
The biggest lesson was that cloud networking is not just about creating resources. It is about understanding how traffic moves between them.
Conclusion
AWS VPC Peering is a useful feature for establishing private communication between separate VPCs.
For beginners learning AWS, implementing this project is a great way to understand cloud networking through practical experience.
My advice to anyone starting their AWS journey is simple:
Don't stop when your peering connection shows Active. Test the connectivity, investigate failures, and understand why a particular configuration works or doesn't work.
I'm continuing my AWS learning journey and look forward to sharing more practical projects, challenges, and lessons with the AWS Builder community.
Let's learn, build, troubleshoot, and grow together!
Official AWS Documentation
Let's Discuss!
What was the most challenging part of your first AWS networking project?
Was it configuring route tables, understanding Security Groups, or troubleshooting connectivity?
Share your experience in the comments. I'd love to learn from other AWS builders!
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article