Skip to main content
Every public IPv4 address is billed per hour, including addresses that subnets or launch templates assign to instances automatically at launch. When those instances only need outbound internet access and the VPC already has a NAT gateway, the public addresses are not needed. nOps finds accounts paying for auto-assigned public IPv4 addresses in regions that already run a NAT gateway, and shows the cost of those addresses as the saving.

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

  1. 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.
  2. Check that the subnets route outbound traffic through the NAT gateway, or move the instances to private subnets that do.
  3. Turn off auto-assign on the subnets: aws ec2 modify-subnet-attribute --subnet-id ID --no-map-public-ip-on-launch.
  4. Set AssociatePublicIpAddress to false in launch templates used by Auto Scaling groups and EKS node groups, then roll the instances.
  5. 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

Without a NAT gateway, removing the public address would cut the instances off from the internet, and adding one has its own cost.