🔷

Editing Route Tables

A Route Table defines how network traffic is directed within a VPC. To enable Internet access for EC2 instances in a public subnet, the Route Table associated with that subnet must be updated.

Key Concepts

  • Each subnet is associated with exactly one Route Table (either explicitly or via the main Route Table).
  • A public subnet must have a route that directs all Internet-bound traffic (0.0.0.0/0) to the Internet Gateway (IGW).
  • The Route Table must be associated with the correct subnet for the changes to take effect.

Steps to Enable Internet Access

  1. Attach an Internet Gateway to the VPC.
  1. Open the Route Table linked to the public subnet.
  1. Add a route:
      • Destination: 0.0.0.0/0 (IPv4) and/or ::/0 (IPv6)
      • Target: The Internet Gateway ID (e.g., igw-xxxxxxxx)
  1. Ensure the subnet’s EC2 instances have a public IP or Elastic IP assigned.

Example

If your public subnet’s CIDR block is 10.0.1.0/24:
  • Route to VPC: 10.0.0.0/16 → local (default)
  • Route to Internet: 0.0.0.0/0 → igw-12345678