πŸ› οΈ Legendary AWS VPC Peering Project

Welcome to the Legendary AWS Networks VPC Peering Project! This detailed guide will walk you through the process of creating secure, private communication between two isolated Virtual Private Clouds (VPCs) in AWS. We’ll use Terraform to automate the entire process while ensuring scalability, efficiency, and best practices.

AWS VPC Peering Banner


πŸš€ Project Overview

In this project, we will:

  1. Provision two VPCs with unique CIDR blocks.

  2. Establish a VPC Peering connection between the two VPCs.

  3. Update route tables to allow traffic flow between the VPCs.

  4. Launch EC2 instances in both VPCs for connectivity testing.

  5. Test private communication between instances in separate VPCs.

  6. Optionally clean up resources after testing.

πŸ”Ή Key Concept:
VPC Peering allows secure, private communication between two isolated networks without using the public internet.


πŸ›£οΈ Process Flow

Here’s a visual flowchart of the VPC Peering setup process:


πŸ› οΈ Step-by-Step Guide

☁️ Step 1: Provision VPCs

  1. Create two VPCs with the following CIDR blocks:

    • VPC 1: 10.1.0.0/16

    • VPC 2: 10.2.0.0/16

  2. Enable DNS resolution and hostnames for both VPCs.

  3. Configure public subnets in each VPC to allow external access.

VPC Setup

🚨 Ensure the CIDR blocks do not overlap to avoid routing conflicts!


πŸ–οΈ Step 2: Establish VPC Peering Connection

  1. Initiate the VPC Peering request from VPC 1 (Requester).

  2. Accept the request in VPC 2 (Accepter).

  3. Verify that the peering connection status is active.


πŸ›£οΈ Step 3: Configure Route Tables

  1. Update the route table in VPC 1:

    • Add a route to direct traffic to VPC 2’s CIDR (10.2.0.0/16) via the peering connection.
  2. Update the route table in VPC 2:

    • Add a route to direct traffic to VPC 1’s CIDR (10.1.0.0/16) via the peering connection.

Route Table Setup

πŸ’‘ Best Practice:
Use descriptive names for your route tables and rules to simplify management.


πŸ’» Step 4: Launch Test EC2 Instances

  1. Launch an EC2 instance in each VPC:

    • VPC 1 Instance: Amazon Linux 2, Public Subnet

    • VPC 2 Instance: Amazon Linux 2, Public Subnet

  2. Assign security groups to allow ICMP (ping) traffic between instances.

EC2 Instances


πŸ” Step 5: Test Connectivity

  1. Use EC2 Instance Connect to SSH into the EC2 instance in VPC 1.

  2. Run a ping test to the private IP address of the EC2 instance in VPC 2.

  3. Ensure successful connectivity:

    • Output: Packets transmitted successfully.

πŸ”Ή Troubleshooting:
If the ping test fails, check security group rules and route table configurations.


πŸͺ© Cleanup (Optional)

If you’re done testing:

  1. Delete the VPC peering connection.

  2. Terminate the EC2 instances.

  3. Remove route table entries.

  4. Delete the VPCs to avoid incurring charges.


🌟 Highlights

  • Automation: Use Terraform to automate the entire process.

πŸ“§ Contact

For questions or feedback, reach out:

πŸ“¨ Email: projects@briankimemia.is-a.dev 🌐 Portfolio: Brian Kimemia GitHub: BrianKN019


Thank you for exploring this project! Let’s innovate and build secure AWS solutions together. πŸš€