AWS
Elastic IP
Cloud Computing
Network Management
Step-by-Step Guide

How to delete an Elastic IP Address in AWS

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

Deleting an Elastic IP in AWS really means releasing it back to AWS so your account no longer owns that public IPv4 address. The important part is not the button click in the console, but understanding what the address is attached to and whether you only want to disassociate it or permanently release it.

Disassociate First, Then Release

An Elastic IP has two separate lifecycle steps:

  • 'disassociate-address removes it from an EC2 instance or network interface'
  • 'release-address returns it to the AWS pool'

That distinction matters because release is destructive from your account's perspective. Once released, the address can be allocated by another AWS customer, and AWS documentation notes that recovery is not guaranteed.

There is also a VPC detail that catches people out. In a nondefault VPC, AWS requires the Elastic IP to be disassociated before it can be released. If it is still attached, the release call fails with InvalidIPAddress.InUse.

Find the Correct Allocation ID

In VPC environments, the safest identifier is the allocation ID, not the raw IP string.

bash
aws ec2 describe-addresses \
  --query 'Addresses[].{PublicIp:PublicIp,AllocationId:AllocationId,AssociationId:AssociationId,InstanceId:InstanceId,NetworkInterfaceId:NetworkInterfaceId}' \
  --output table

This shows whether the Elastic IP is still associated and gives you the IDs needed for the next step.

If AssociationId is present, the address is still attached to something.

CLI Workflow

A clean release workflow looks like this.

bash
1# 1. Inspect the address
2aws ec2 describe-addresses --allocation-ids eipalloc-0123456789abcdef0
3
4# 2. Disassociate if needed
5aws ec2 disassociate-address --association-id eipassoc-0123456789abcdef0
6
7# 3. Release it
8aws ec2 release-address --allocation-id eipalloc-0123456789abcdef0

If the command succeeds, the Elastic IP is gone from your account.

If you prefer the console, the flow is the same in substance: locate the Elastic IP in the EC2 console, verify it is no longer required, disassociate it if needed, and then choose the release action.

Be Careful With What the Address Is Attached To

Releasing an unused Elastic IP is straightforward. Releasing one that is still part of a running system is not.

Common attachments include:

  • EC2 instances
  • Elastic network interfaces
  • NAT gateways
  • legacy failover setups where DNS still points at the Elastic IP

One especially common mistake is deleting a NAT gateway and assuming the associated Elastic IPs are automatically released. They are not. The NAT gateway deletion disassociates them, but the addresses remain allocated to your account until you release them explicitly.

That means the cleanup sequence for NAT gateways is usually:

  • delete the NAT gateway
  • wait for deletion to complete
  • release the now-unused Elastic IP allocations

A Small Safety Check Before Release

Because Elastic IP release can break traffic immediately, do a quick dependency check.

bash
aws ec2 describe-addresses \
  --allocation-ids eipalloc-0123456789abcdef0 \
  --query 'Addresses[0].{PublicIp:PublicIp,InstanceId:InstanceId,AssociationId:AssociationId,NetworkInterfaceId:NetworkInterfaceId,Tags:Tags}'

Then confirm:

  • DNS records no longer reference the address
  • monitoring or firewall rules do not still depend on it
  • you are in the correct AWS region
  • the address is not reserved for an upcoming cutover or failover plan

The region check is important because Elastic IPs are regional resources. Looking in the wrong region often makes people think an address has already been deleted.

Permissions You Need

At minimum, the IAM principal performing the cleanup usually needs permissions such as:

  • 'ec2:DescribeAddresses'
  • 'ec2:DisassociateAddress'
  • 'ec2:ReleaseAddress'

In tightly controlled environments, the release action may be restricted to infrastructure automation roles. That is often a good idea because releasing an address is harder to undo than disassociating one.

Common Pitfalls

The biggest mistake is confusing disassociation with deletion. If you only disassociate the address, AWS still charges for an allocated idle Elastic IP and the resource still exists in your account.

Another mistake is trying to release an address that is still attached in a nondefault VPC. AWS rejects that operation until you remove the association.

A third issue is forgetting downstream systems. DNS, allowlists, partner integrations, and webhook endpoints may still be configured to talk to the old public IP.

Finally, do not release an Elastic IP if all you need is a temporary detach for maintenance. In that case, disassociate it and keep the allocation.

Summary

  • Releasing an Elastic IP is the AWS equivalent of deleting it from your account.
  • Disassociation and release are different operations.
  • In nondefault VPCs, the address must be disassociated before release.
  • Use the allocation ID for safe CLI operations.
  • Check NAT gateways, DNS, and integrations before releasing the address.
  • If you may need the same address later, disassociate it instead of releasing it.

Course illustration
Course illustration

All Rights Reserved.