If you want to run application instances or lambdas in a private subnet you need to have a NAT gateway if you want them to be able to make outbound internet connections. Running your applications in a private subnet is desirable from a security perspective because they won’t be accessible from the public internet. You can run load balancers in a public subnet and route traffic to the app instances in the private subnet.
In fact, you can run anything you want
VPC endpoints to which services? it will cost less per GB but there is a cost per VPC endpoint. You need to add more details.
Depends on your use case. I am in favour to use NAT GW as in specific industry you want to have some levels of SLAs and similar rules. If you use self-NAT-GW as many comments suggest, you move that responsibility back to you instead of using AWS mechanisms for HA and security.
just … networking?
You could run resources in public subnets instead. Though, that has obvious downsides.
And depending on what traffic you need to let out, your NAT instance can do egress traffic filtering for extra security goodness too.
Thanks for sharing this. Never knew it existed and am sad it took me so long to learn about it, but am happy now!
Agreed, they are expensive. Use IPv6-only, and NAT Gateways are a thing of the past. ![]()
Their egress costs are asinine compared to most other cloud vendors (not counting big 3).
Loxilb is free and provides both LB and NAT.
What’s the plus point to not doing it this way?
Brilliant!
Unless you want high availability, and scalability.
But for person project, yes
I lol’d, shared it with coworkers, and then lol’d some more!
Why would you not count the big 3 when comparing one of the big 3 to “other cloud vendors”
Because the “big 3” tend to be universally overpriced for certain things. Storage, egress, etc.
Overpriced is a very strong word to use.. it’s definitely not apples to apples
Running your applications in a private subnet is desirable from a security perspective because they won’t be accessible from the public internet.
security groups exist.
To place your database behind it so that it’s not directly accessible via the internet.
security groups exist.
there are valid reasons to use a NAT gateway, mitigating security and data protection liability being the most significant
NAT is not security. never has been, never will be.