AWS / Networking

AWS public IPv4 charges: find and remove idle Elastic IPs

Every public IPv4 address in an AWS account now has an hourly price, whether it serves traffic or sits unused. One address is cheap. Fifteen forgotten ones in a dev account are a monthly line item nobody chose.

What changed in February 2024

Before 2024, only idle Elastic IPs and extra Elastic IPs on an instance were billed. AWS announced in July 2023 that from 1 February 2024 it would charge $0.005 per hour for all public IPv4 addresses, whether attached to a service or not.

The Amazon VPC pricing page lists the same $0.005 hourly rate for in-use and idle addresses. That works out to about $3.65 per address for a 730-hour month, or $43.80 a year. Check the pricing page for your Region before using these numbers, because prices can change.

Addresses you bring to AWS with BYOIP are not charged, according to the announcement. Everything else counts.

Which resources hold a public IPv4 address

The obvious ones are EC2 instances and Elastic IPs. The IPAM Public IP insights documentation also lists service-managed addresses on:

  • Application and Network Load Balancers
  • public NAT gateways
  • publicly accessible RDS instances
  • Redshift clusters and DMS replication instances
  • Global Accelerator and Site-to-Site VPN

The same page names ECS and WorkSpaces as further examples of services that provision public IPv4 addresses for you. These addresses often do not appear in the EC2 Elastic IPs console, which is why the total is easy to underestimate.

Do stopped resources still pay?

It depends on the kind of address.

  • EC2 auto-assigned public IP. The EC2 addressing documentation says AWS releases it when the instance is stopped, hibernated or terminated, and assigns a new one at start. While the instance is stopped, there is no address to bill. The address changes on every restart.
  • Elastic IP. An Elastic IP stays allocated to your account until you release it. The Elastic IP documentation says you are charged for every Elastic IP in the account, associated or not. Stopping the instance does not stop the charge.
  • Publicly accessible RDS instance. The RDS stop documentation states that a stopped, publicly accessible instance keeps its public IP and continues to be charged for it, alongside storage and backups.

So a stop schedule removes the IPv4 charge for auto-assigned EC2 addresses, but not for Elastic IPs or public RDS endpoints. The hidden costs of stopping RDS covers the other charges that keep running.

A worked example

Take a typical dev/test account with 15 public IPv4 addresses. All figures use $0.005 per hour and a 730-hour month. Your prices may vary.

SourceAddressesBilled hoursPer month
Unassociated Elastic IPs3730$10.95
Elastic IPs on dev instances stopped at night2730$7.30
Auto-assigned IPs on dev EC2 running 24/78730$29.20
Publicly accessible dev RDS instances2730$7.30
Total1510,950$54.75

That is about $657 a year for addresses that mostly serve nobody. Now apply the fixes below:

  • Release the 3 unassociated Elastic IPs: $10.95 saved.
  • Make the 2 RDS instances private and reach them through a bastion or Session Manager: $7.30 saved.
  • Stop the 8 dev instances outside a 10-hour, 5-day working week. They run about 217 hours a month instead of 730, so their auto-assigned addresses cost about $8.67 instead of $29.20.

The bill drops from $54.75 to about $16 a month: the 2 Elastic IPs that are still needed plus the reduced EC2 hours. Removing public IPs from the 8 instances altogether would bring it lower still.

15 public IPv4 addresses at $0.005 per hour cost $54.75 a month. Releasing idle Elastic IPs, making dev RDS private and stopping dev EC2 at night brings it to about $16.
Same rate for in-use and idle addresses. The count and the billed hours are what you can change.

Find every public IPv4 address

IPAM Public IP insights

Open the IPAM console and choose Public IP insights. It groups addresses by type (Elastic IPs, EC2 public IPs, service-managed, BYOIP), shows which are unassociated, and names the service behind each one. With an IPAM integrated with AWS Organizations, it covers every account and Region. The VPC pricing page notes that Public IP insights is available in the IPAM Free Tier.

Cost and Usage Report and Cost Explorer

AWS added two usage types for this charge, described in its networking blog: PublicIPv4:InUseAddress and PublicIPv4:IdleAddress. Filter or group by usage type in Cost Explorer to see the monthly trend. In the Cost and Usage Report, the line item operation tells you the source. AllocateAddressVPC marks idle Elastic IPs, RunInstances marks EC2 public IPs, and DescribeNetworkInterfaces marks service-managed addresses.

The AWS CLI

List Elastic IPs that are not associated with anything, Region by Region:

aws ec2 describe-addresses \
  --query "Addresses[?AssociationId==null].[PublicIp,AllocationId]" \
  --output table

Then list RDS instances that are publicly accessible, including stopped ones:

aws rds describe-db-instances \
  --query "DBInstances[?PubliclyAccessible].[DBInstanceIdentifier,DBInstanceStatus]" \
  --output table

Remove the addresses you do not need

Release idle Elastic IPs

Confirm that no DNS record, allowlist or partner firewall depends on the address, then release it:

aws ec2 release-address --allocation-id eipalloc-0123456789abcdef0

AWS may let you recover a released address, but not if another account has taken it, and its tags are lost. Treat a release as permanent.

Turn off auto-assign on subnets

Default subnets assign a public IPv4 address to new instances, and so do subnets created by the EC2 launch wizard, according to the VPC subnet documentation. Switch the attribute off where instances do not need to be reached from the internet:

aws ec2 modify-subnet-attribute \
  --subnet-id subnet-0123456789abcdef0 \
  --no-map-public-ip-on-launch

This applies to instances launched afterwards. Existing instances keep their address until you remove it from the network interface or replace the instance.

Make dev databases private

A dev RDS instance rarely needs a public endpoint. Disable public access, and connect through a bastion host or Session Manager port forwarding inside the VPC:

aws rds modify-db-instance \
  --db-instance-identifier dev-postgres \
  --no-publicly-accessible

The CLI reference notes that this change applies immediately, regardless of the apply-immediately setting. Plan it with the people who connect to the database.

Share fewer, larger entry points

AWS's public IPv4 optimization list suggests putting instances behind a load balancer with auto-assign disabled, and consolidating load balancers. For SSH-only access, EC2 Instance Connect Endpoint reaches instances that have no public IPv4 address. PrivateLink connects to AWS services without one.

A NAT gateway in front of private instances can replace many instance addresses, but it has its own hourly and per-GB charges. The same AWS page gives a formula to compare the two. At the rates on that page, one NAT gateway in one Availability Zone costs as much per hour as nine public IPv4 addresses, before data processing.

Move to IPv6 where clients allow it

The charge is for public IPv4. EC2 supports IPv6-only subnets, and an IPv6 address persists across stop and start. This works when everything that talks to the resource can use IPv6, which is more common for internal traffic than for public users.

Where scheduling fits

SnoozeDB schedules RDS and EC2 start and stop outside working hours. It does not manage, release or reassign IP addresses. The IPv4 effect is a side effect of the stop: AWS releases an EC2 instance's auto-assigned public IP while it is stopped, so fewer hours are billed. Elastic IPs and public RDS addresses keep billing whatever the schedule.

Release idle addresses and remove public access first, then schedule what remains. The guide to stopping and starting EC2 automatically covers how to choose instances safely, including the address change at every start.