☁️

Guide to AWS Transit Gateway Setup

Feb 22, 2025

AWS Transit Gateway Setup for VPC Communication

Introduction

  • The session demonstrates setting up a Transit Gateway in AWS.
  • Purpose: Enable communication between multiple VPCs within a single AWS account.
  • We will create 3 VPCs: test VPC1, VPC2, and VPC3.

VPC Setup

  • For each VPC (1, 2, 3):
    • Create a VPC with a specific IP range.
    • Set up subnets in each VPC.
    • Deploy EC2 instances within these subnets.

Steps to Create VPC

  1. Access AWS Console, navigate to VPC section.
  2. Create VPC with desired IP range (e.g., 12.0.0.0/16 for VPC1).
  3. Create an Internet Gateway and attach it to the VPC.
  4. Set up a subnet with specified IP range (e.g., 12.0.0.0/24).
  5. Create a route table, associate it with the subnet, and configure routes for internet access.
  6. Launch an EC2 instance, set up key pairs, and configure network settings.

Setting Up the Transit Gateway

  • Purpose: Establish a single point of communication for multiple VPCs.
  • Access Transit Gateway in the AWS Console.
  • Create a Transit Gateway and note its configuration.

Creating Attachments

  • Create a transit gateway attachment for each VPC.
  • Attach VPC1, VPC2, and VPC3 to the Transit Gateway.

Configuring Route Tables

  • Purpose: Ensure subnets know how to route requests via the Transit Gateway.

Steps for Route Table Configuration

  1. Access each VPC's route table.
  2. Add routes to ensure communication between VPCs.
    • Example: VPC1’s route table should have entries for VPC2 and VPC3.
  3. Use Transit Gateway attachments to define these routes.

Testing Connectivity

  • SSH into each EC2 instance (VPC1, VPC2, VPC3).
  • Use curl to test access to the Apache homepage on EC2 instances in different VPCs.
  • Verify communication is established between VPCs via the Transit Gateway.

Key Learnings

  • Transit Gateway vs. VPC Peering
    • Transit Gateway simplifies connecting multiple VPCs compared to VPC peering.
    • Efficient with many VPCs.

Conclusion

  • Successfully set up and tested a Transit Gateway with VPC attachments.
  • Demonstrated VPC communication using the Transit Gateway.
  • Encouragement to follow more in-depth content on Terraform and AWS.
  • Access to exclusive content for members including a Discord group.

Additional Resources

  • Consider joining the YouTube channel for advanced sessions on DevOps and AWS.

  • Note: Ensure differing IP ranges for each VPC to avoid conflicts.
  • Naming Conventions: Use suffixes (e.g., VPC1, VPC2) for easy identification of resources.

End of Session