NAT Gateway
Network address translation (NAT) grateways enables instances in a private subnet to connect to the internet or other AWS services while preventing the internet from initiating a connection with those instances.
NAT (Network Address Translation) gateways are not allowed by default in AWS. When you create a new VPC, by default you only get:
The VPC itself with its CIDR range
A main route table
A network ACL
A security group.
Key characteristics:
Redundant inside the Availability Zone
Start at a 5 Gbps and scales currently to 45 Gbps
No need to patch
Not associated with security groups
Automatically assigned a public IP address
To enable NAT functionality for private subnets to access the internet, you need to explicitly:
Create a NAT Gateway in a public subnet
Configure route table entries to route traffic from private subnets through the NAT Gateway
Ensure you have an Internet Gateway attached to your VPC
Have the proper routing set up in your public subnet
Keep in mind that NAT Gateways incur additional AWS charges, which is another reason they're not enabled by default
Reducting Costs
If you're looking to reduce costs, you could consider:
Using a NAT Instance instead of a NAT Gateway
Cheaper but requires more management
Less reliable as it's a single point of failure
You manage the instance yourself
Using other architectural patterns:
Placing instances in public subnets where appropriate
Scheduling NAT Gateway usage if you don't need 24/7 availability
Using VPC endpoints for AWS services instead of routing through NAT
Last updated
Was this helpful?