How Many NAT Gateways Do You Need in AWS?

How Many NAT Gateways Do You Need in AWS? One or Per AZ?

When designing your AWS network, a common question arises: should you use a single NAT Gateway or one per Availability Zone (AZ)? The answer depends on your priorities—whether it's cost, availability, or resilience. While a single NAT Gateway can save money, it also creates a single point of failure that could disrupt your workloads if an AZ goes down.

If high availability is a concern, using at least two NAT Gateways is the better approach. Many AWS users deploy one per AZ to ensure that private instances maintain outbound internet access even if an entire AZ experiences an outage. However, it’s important to recognize that an AZ failure impacts more than just networking—your database replicas, EC2 instances, and load balancers may also be affected. Before committing to a NAT Gateway strategy, it’s worth checking how often AZ failures have occurred in your chosen AWS region.

Balancing Cost and Resilience

One of the main reasons teams hesitate to deploy multiple NAT Gateways is cost. AWS charges a fixed hourly rate per NAT Gateway, plus per-GB data processing fees. If you place a single NAT Gateway in one AZ and route all traffic through it, you might face unexpected inter-AZ data transfer charges. This means that while a single NAT Gateway setup may look cheaper at first, cross-AZ traffic costs can make it more expensive than expected.

A middle-ground approach is to deploy two NAT Gateways across two AZs instead of one per AZ. This setup reduces costs while still providing some redundancy. Additionally, automation can be used to reroute traffic in case one NAT Gateway fails.

An Alternative to NAT Gateway: fcknat

For teams looking to further optimize costs, fcknat is an alternative worth considering. Instead of relying on AWS-managed NAT Gateways, fcknat allows you to build a NAT solution using EC2 instances. This helps avoid AWS’s high data transfer fees while still maintaining network redundancy.

Choosing the Right Strategy

If high availability is your priority, using one NAT Gateway per AZ is the safest choice. If cost savings are more important, two NAT Gateways with automated failover can be a good compromise. For those wanting the lowest possible cost, fcknat provides an alternative that avoids AWS’s pricing model altogether.

Ultimately, an AZ failure impacts more than just NAT Gateways, so it’s essential to design your entire architecture with redundancy in mind.

How many NAT gateways should I have in AWS?

NAT Gateway count matters

Overwhelmed by AWS?

Struggling with infrastructure? We streamline your setup, strengthen security & optimize cloud costs so you can build great products.

Related AWS best practices blogs

Looking for more interesting AWS blog posts?

AWS Client VPN Alternatives: Why You Should Look Elsewhere

AWS Client VPN is expensive and often overkill—there are better alternatives that cost a fraction of the price.

Read more

Cloudflare WAF vs. AWS WAF: Why Cloudflare is the Better Choice

Compare Cloudflare WAF and AWS WAF to discover why Cloudflare stands out as the superior choice for web application security. Explore key differences in security, ease of use, pricing, and built-in fe ...

Read more

Customizing a Standard Docker Image and Pushing to AWS ECR with GitHub Actions

Picking the right region for your workloads is paramount. It goes way beyond what region is the closest to your customers.

Read more

ES Foundation to be officially launched at SaaS Summit Benelux 2024

Today we are announcing the launch of our new PaaS platform ES Foundation. A cloud agnostic platform as a service aimed specifically at solving all infrastructure headaches for growing SaaS companies. ...

Read more
AWS ECS

Getting a shell inside a container on AWS ECS

Sometimes you need to be able to get a shell in an ECS container (ie. bash). Mostly this is to debug some issue in the container. Before 2021 this was practically impossible until AWS launched ECS Exe ...

Read more

Reduce AWS Fargate pull times with SOCI

One of the major drawbacks of AWS Fargate is that the pull times are relatively slow (compared to EC2). This is because EC2 nodes can have a local image cache on the instance. Fargate is serverless co ...

Read more

How to ensure your AWS account is not compromised

Read more to learn the different ways your AWS account can get compromised, how to avoid it, and what to do if you suspect it is compromised.

Read more