Add Transit Gateway Routes to VPC Route Tables

Overview

ℹ️ Information: In this section, you will configure the route tables in each VPC to direct traffic through the Transit Gateway. This enables communication between VPCs through the Transit Gateway.

Configure VPC Route Tables

  1. Access VPC Route Tables
    • Open VPC Management Console
    • Select Route Tables in the left sidebar
    • Identify the main route tables for each VPC:
      • First VPC Main Route Table = Route Table of VPC1
      • Second VPC Main Route Table = Route Table of VPC2
      • Third VPC Main Route Table = Route Table of VPC3
      • Fourth VPC Main Route Table = Route Table of VPC4

Route Tables

Configure VPC1 Route Table

  1. Edit VPC1 Routes
    • Select the route table for VPC1
    • Click Edit routes

Edit VPC1 Routes

  1. Add Transit Gateway Route
    • Destination: 172.16.0.0/16
    • Target: Select your Transit Gateway

💡 Pro Tip: The CIDR block 172.16.0.0/16 covers all VPCs in this lab, enabling communication between them.

Add VPC1 Route

  1. Verify VPC1 Route
    • Confirm the route is added successfully
    • This enables VPC1 to route traffic to other VPCs through the Transit Gateway

Verify VPC1 Route

Configure VPC3 Route Table

  1. Edit VPC3 Routes
    • Select the route table for VPC3
    • Click Edit routes

Edit VPC3 Routes

  1. Add Transit Gateway Route
    • Destination: 172.16.0.0/16
    • Target: Select your Transit Gateway

Add VPC3 Route

  1. Verify VPC3 Route
    • Confirm the route is added successfully
    • This enables VPC3 to route traffic to other VPCs through the Transit Gateway

Verify VPC3 Route

Configure VPC2 Route Table

  1. Edit VPC2 Routes
    • Select the route table for VPC2
    • Click Edit routes

Edit VPC2 Routes

  1. Add Transit Gateway Route
    • Destination: 0.0.0.0/0
    • Target: Select your Transit Gateway

ℹ️ Information: The 0.0.0.0/0 route enables VPC2 to route all non-local traffic through the Transit Gateway.

Add VPC2 Route

  1. Verify VPC2 Route
    • Confirm the route is added successfully
    • This enables VPC2 to route traffic through the Transit Gateway

Verify VPC2 Route

Configure VPC4 Route Table

  1. Edit VPC4 Routes
    • Select the route table for VPC4
    • Click Edit routes

Edit VPC4 Routes

  1. Add Transit Gateway Route
    • Destination: 0.0.0.0/0
    • Target: Select your Transit Gateway

Add VPC4 Route

  1. Verify VPC4 Route
    • Confirm the route is added successfully
    • This enables VPC4 to route traffic through the Transit Gateway

Verify VPC4 Route

Test Connectivity

  1. Test Internet Connectivity
    • Connect to VPC1 instance via SSH
    • Test internet connectivity:
    ping amazon.com -c5
    

Internet Test

  1. Test Inter-VPC Connectivity
    • Ping instances in other VPCs
    • Verify successful connectivity

Inter-VPC Test

  1. Connect to VPC2 Instance
    • Use SSH to connect to VPC2 instance
    • Use the key pair file:
    chmod 400 <keypairname.pem>
    ssh -i "<YourKey.pem>" ec2-user@<YourEC2IP>
    

VPC2 Connection

  1. Verify Full Connectivity
    • Test connectivity between all VPCs
    • Confirm successful ping tests

🔒 Security Note: Ensure your security groups allow the necessary traffic between VPCs for your specific use case.

Full Connectivity