Stop Paying for Idle NAT Gateways in Staging Environments

A guide to automating the shutdown of expensive networking resources when developers sleep.

J
Jesus Paz
1 min read

Your developers work 40 hours a week. Your Staging NAT Gateway works 168 hours a week. That means 76% of your bill is for a service nobody is using.

The Savings Potential

If a NAT Gateway costs ~$33/month:

  • Running 24/7: $33.
  • Running 9-to-5 (M-F): $8. (75% savings).

Now multiply that by 3 AZs and 4 environments. The savings are real.

How to Automate It

You cannot simply “Start/Stop” a NAT Gateway like an EC2 instance. You have to Delete and Recreate it.

The “Nuke” Script

  1. Friday 7pm: Cron job runs Terraform/OpenTofu destroy.
    • Deletes NAT Gateways.
    • Updates Route Tables to remove the 0.0.0.0/0 target.
  2. Monday 7am: Cron job runs Terraform apply.
    • Creates new NAT Gateways.
    • Updates Route Tables.

The “Private” Alternative

Instead of deleting them, why do you need them at all? Staging environments often only need to talk to internal services. If you can mock external APIs, you can run Staging in a Private Subnet with NO Internet Access.

  • Cost: $0.
  • Security: Improved.

[!TIP] Calculate the waste. Use our NAT Gateway Cost Calculator to see how much “Idle Time” is costing you per year across all your environments.

👨‍💻

Jesus Paz

Founder & CEO

Read Next

Join 1,000+ FinOps and platform leaders

Get Kubernetes and ECS cost tactics delivered weekly.