Route Tables, Internet Gateway, and NAT Gateway
Explore how AWS route tables direct network traffic in a VPC, how internet gateways enable communication between VPC instances and the internet, and how NAT gateways allow private subnet instances to securely access external resources without exposure to inbound internet connections. Understand the roles and configurations of these networking components to build secure and efficient cloud environments.
We'll cover the following...
Route tables
Route tables contain a set of rules that serve as guides for directing network traffic within a VPC. They determine where network traffic from our network or gateways should be routed. By default, every VPC is created with a main route table, and each subnet in the VPC is automatically associated with this main route table. The main route table cannot be deleted. However, we can modify its routes.
We do have the option of creating customized route tables for our subnet. One thing to keep in mind here is that we can only attach one route table with one subnet, whereas multiple subnets can be associated with a single route table.
Routes in route tables
In a route table, a route is a rule that defines how a VPC traffic flows. Each route in a table has a target and a destination. By default, every route table has a local route used for communication within the VPC.
Let’s look at an example of a route table with some sample routes:
Description | Destination | Target |
A route to allow private subnets to connect to the internet using a NAT gateway | 0.0.0.0/0 | nat-gateway-id |
A route to give internet access to a subnet using internet gateway | 0.0.0.0/0 | internet-gateway-id |
A route to allow instances in a private subnet to communicate with the internet using an egress-only internet gateway | ::/0 | egress-gateway-id |
Internet gateways
An internet gateway is a component that facilitates communication between instances within a VPC ...