AWS Route Tables
A route table is a set of rules, called routes, that determine where the network traffic of a subnet (or of a gateway) is directed. Every subnet of a VPC is associated with one route table.
Key concepts #
- Local route: every route table has a route for the CIDR block of the VPC, so all the resources of the VPC can talk to each other. It cannot be deleted.
- Destination and target: each route sends a destination (a CIDR block such as
0.0.0.0/0) to a target: an Internet Gateway, a NAT Gateway, a VPC peering connection, a Transit Gateway, a VPN or a VPC endpoint. - Most specific route wins (the longest prefix).
- Main route table: the one used by the subnets that are not explicitly associated with another table.
- A subnet is public when its route table sends
0.0.0.0/0to an Internet Gateway, and private when it sends it to a NAT Gateway or has no Internet route.
Pricing #
Route tables are free. The gateways and connections that they point to may have a cost.
With Terraform #
The resources are aws_route_table, aws_route, aws_route_table_association and aws_main_route_table_association.
See tutorials:
More tutorials that use Route Tables
- AWS VPC Subnets, Routing Tables and Internet Access using Terraform (2/5)
- Terraform AWS EKS Cluster Deployment & Application Publishing through ALB
- Terraform AWS ECS Fargate Cluster Deployment & Docker Container Publishing
- AWS Basic VPC Elements
- AWS with Terraform Tutorial: AWS NAT Gateway (7)
- AWS with Terraform Tutorial: AWS EC2 Instances (12)
- AWS with Terraform Tutorial: AWS Internet Gateway (6)
- AWS with Terraform Tutorial: AWS VPC (4)