Why it matters
NAT gateways are among the more expensive networking resources to leave running, and one is often created per Availability Zone.How nOps finds it
nOps reads the last 90 days of billing for each NAT gateway. One is flagged when its hourly charge was billed on at least 85 of those days and in the last 2 days, and it processed zero bytes in the whole 90 days. The saving is the hourly charge billed in the last 30 days, and must be at least $1.Before you start
Permission to delete NAT gateways and release addresses (ec2:DeleteNatGateway, ec2:ReleaseAddress).
How to implement
- Note the NAT gateway’s Elastic IP:
aws ec2 describe-nat-gateways --nat-gateway-ids ID. - Find route tables that still point at it (
aws ec2 describe-route-tables --filters Name=route.nat-gateway-id,Values=ID) and remove or replace those routes. - Delete it: VPC → NAT gateways → Actions → Delete NAT gateway, or
aws ec2 delete-nat-gateway --nat-gateway-id ID. - Release its Elastic IP afterwards, or it keeps billing as an idle public IPv4 address.
- Remove it from Terraform or CloudFormation so it is not recreated.
Risks and considerations
- Routes that still target the deleted NAT gateway become blackhole routes. Fix them first.
- Deletion cannot be undone; a new NAT gateway gets a new ID, and a new IP unless you reuse the Elastic IP.
FAQs
Do I need to release the Elastic IP too?
Do I need to release the Elastic IP too?
Yes. Deleting the NAT gateway does not release its Elastic IP, which then bills as an idle address.