Nat gateways are too expensive (2023)

Nat gateways are expensive for me. I heard that we can use VPC endpoints but I need to use NAT gateway. Can I get any other alternative to NAT gateway?

You can run your own NAT instance on EC2.

If you can live with IPv6 only – you can use an egress only internet gateway which I don’t think costs anything itself.

But otherwise no. You can roll your own NAT gateway with an EC2 instance but not worth the effort usually.

https://github.com/AndrewGuenther/fck-nat

https://fck-nat.dev/

Run your own on EC2!

Check out alterNAT. https://github.com/1debit/alternat

If you’re comfortable with Linux, a NAT instance could be the way to go:

https://docs.aws.amazon.com/vpc/latest/userguide/VPC_NAT_Instance.html

s/ for me./!/

+1 for alterNAT, especially if your primary concern is data processing fees. The fallback via route table/Lambda also allows to use the managed NAT GW as standby in case the EC2 NAT instance(s) fail.

If you are concerned about the hourly costs for the managed NAT gateway (used as standby by alterNAT) and don’t need 5 9s of availability/fallback then fck-nat is the better choice.

While you can roll your own like others are suggesting, do keep in mind that NAT Gateway autoscales on its own. Make sure you understand and monitor the limits of your own NAT instances if you plan to do it yourself.

AWS networking is expensive

why do you think you need to use a NAT gateway?

We’re building out Transit Gateways, which allows for reducing the total number of NAT Gateways that we have to track for IP Allow-listing, among other uses.

We also dabbled with IPv6, and it was nice seeing traffic go directly out the Egress Only Internet Gateway without having to deal with NAT. We’ll be recommending dual-stack VPCs for new workloads going forward to help keep our NAT data processing fees down.

Tried this this week, its just fabolous i love it

Asking the real questions right here!

The number of NAT Gateways isn’t the problem, it’s the per-GB pricing. Transit Gateway is the same. Transit Gateway is super cool but I can’t recommend it to anyone because it’s so exorbitant.

To place your database behind it so that it’s not directly accessible via the internet. Sure, maybe overkill if OP’s app isn’t storing user data or other sensitive information in the database but there are valid reasons to use a NAT gateway, mitigating security and data protection liability being the most significant.

t3.micro checking in. WHY CANT I GET THROUGHPUT?!

Databases shouldn’t need to reach out to the public internet, so they should be just fine in a private subnet without a NAT gateway.

The right solution for avoiding NAT gateway, if you’re small enough scale that the price impacts you, is to create NAT instances instead. Plus, a NAT instance can also do double-duty as a bastion host.

What are these CPU credits of which you keep speaking?

Fun fact: Bezos 3rd yacht was funded directly by the NAT Gateway team.

This was told to me at a bar during re:Invent around 3:30am. Take it for what you want.