Why it matters
Auto-assign public IP is on by default in default VPCs and in many templates, so fleets of instances, Auto Scaling groups and EKS nodes each pay for an address they do not use.How nOps finds it
nOps reads the last 7 complete days of in-use public IPv4 charges for addresses assigned at instance launch, per account. It counts only regions where the same account was billed for a NAT gateway in those 7 days. The saving is the cost of those addresses, scaled to a month, and must be at least $20 a month. The extra NAT gateway data-processing charge for traffic that moves off the public addresses is not deducted.Before you start
A NAT gateway route for the private subnets the instances will use, and permission to modify subnets and launch templates (ec2:ModifySubnetAttribute, ec2:CreateLaunchTemplateVersion).
How to implement
- List the instances with auto-assigned public IPs and confirm none needs direct inbound internet access. Use a load balancer, Session Manager or EC2 Instance Connect Endpoint for access instead.
- Check that the subnets route outbound traffic through the NAT gateway, or move the instances to private subnets that do.
- Turn off auto-assign on the subnets:
aws ec2 modify-subnet-attribute --subnet-id ID --no-map-public-ip-on-launch. - Set
AssociatePublicIpAddressto false in launch templates used by Auto Scaling groups and EKS node groups, then roll the instances. - Update Terraform or CloudFormation with the same settings.
Risks and considerations
- Instances lose any direct inbound access over their public address, and outbound traffic now pays NAT gateway data-processing charges.
- Existing instances keep their address until they are replaced or the address is removed, so the saving arrives as instances are relaunched.
- Idle (unattached) addresses are a separate recommendation.
- To roll back, turn auto-assign back on and relaunch the instances.
FAQs
Why only regions with a NAT gateway?
Why only regions with a NAT gateway?
Without a NAT gateway, removing the public address would cut the instances off from the internet, and adding one has its own cost.