Skip to the workspace
Pebellslearn by building
VPC — Your Private Network  ›  Lesson

Route Tables and the Internet Gateway

Route Tables 14 minA route table lists destinations and targets for a subnet's traffic, the most specific matching route wins, and a route to an internet gateway is what connects a subnet to the internet.

aws / Route Tables and the Internet Gateway

Explore each scene at your own pace.

01 · The rule

The rule

Route Tables and the Internet Gateway

A web server in Inkwell's public subnet sends two packets: one to the database next door, one to a payment provider on the internet. Nothing about the packets says "inside" or "outside". A small table attached to the subnet makes that decision for every packet, many times a second.

The rule

Most specific route wins; local is always there.

A route table is a list of rules, each with a destination (a CIDR block) and a target (where to send matching traffic). Every subnet is associated with exactly one route table; a subnet you do not associate explicitly uses the VPC's main route table. One route table can serve many subnets.

Inkwell's public route table:

Destination      Target
10.0.0.0/16      local
0.0.0.0/0        igw-inkwell
  • The local route covers the whole VPC. AWS adds it to every route table automatically and it cannot be deleted, so subnets in a VPC can always reach each other (security groups still decide what is allowed).
  • 0.0.0.0/0 means "any IPv4 address". Here it points to the internet gateway.

An internet gateway is the VPC's door to the internet. You create it, attach it to the VPC (one per VPC), and route to it. AWS runs it as a highly available, horizontally scaled service, so it is not a bottleneck and is not tied to one zone. The gateway also translates between an instance's private address and its public IPv4 address.

When a packet matches several routes, the one with the longest prefix, the biggest number after the slash, wins.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.