I was looking at my AWS bill and saw a line item called EC2-other which was about half of my bill. It was strange because I only have 1 free tier EC2 instance, and mainly use ECS spot instances for dev. I went through all the regions couldn’t find any other instances, luckily for me the culprit appeared after I grouped by usage. I setup a Nat-gateway, so I could utilize private subnets for development. This matters because I use CDK and Terraform, so having this stuff down during dev makes it easy to transition to prod. I didn’t have any real traffic so why does it cost so much.
The line item suggests to me that a Nat gateway is just a managed nat instance, so I guess I learnt something.
Sorry if I’m incoherent, really spent some time figuring this out and I’m just in rant mode.
this is my guess too. those are dedicated hardware, not shared service. makes sense, as they can deliver quite hefty traffic. same goes for privatelink.
NAT Gateways are one of the classic AWS gotchas. They can really run up a bill quickly without you realizing it. What’s “funny” is that you can set up your own NAT Gateway on AWS for way cheaper, but I suppose that’s a burden many would rather just pay away.
If you haven’t figured it out yet, a potential way to avoid NAT Gateways (or at least reduce their costs) is to utilize VPC endpoints. Some AWS services support VPC endpoints, and using them would be cheaper than using a NAT gateway.
I mean, I suppose it matters what the requirements are. If you can just use a public subnet, then obviously you can avoid VPC endpoints or a NAT Gateway. Why even bother with NAT Gateways or private subnets at all at that point, though?
When you can’t have public subnets (e.g., for security reasons), then you’ll have to figure out another solution. I’m not sure what the situation is with the OP, but presumably they’re avoiding doing exactly what you’re suggesting. I mean, that is the default configuration for the default VPC, after all, so presumably the OP consciously decided to not do it that way. I know that I work on projects that can’t be connected to the internet at all (i.e., I’m forbidden to even use NAT Gateways), so the VPC endpoints are a necessity if I want AWS services to be able to interact with each other.
The NAT gateway is cheaper if you don’t have much traffic (less than maybe 100 GB / mo I think I estimated before) and it takes too much effort to patch your own equivalent NAT instances regularly and rotate them out. Obviously if your team’s time is worth nearer to $0 / patch or the cost of auditing a NAT instance is into the hundreds then the NAT instance is cheaper.
Hey guys unrelated but you guys have any recommendations connecting a local network to aws Windows server at the cheapest rate or VPN is the best way to go about this?
If you’ve configured a VPC to utilize private subnets you’re doing it properly. You do need a NAT device to talk egress; however, it can rack up costs fast if you don’t harness VPC endpoint gateways and interfaces. I’d recommend turning on flow logs and determining where your traffic is heading when it traverses the nat . If majority is s3 a free gw endpoint will save you tons.