...

/

Route Tables, Internet Gateway, and NAT Gateway

Route Tables, Internet Gateway, and NAT Gateway

Learn how to restrict access to resources inside VPC using route tables, internet gateway, and NAT gateway.

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.

Press + to interact

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 ...