EC2: Release Unused AWS Elastic IP Addresses

Service
EC2
difficulty
Easy
Easy
Medium
Hard
Zero downtime, zero performance risk
Zero downtime, potential performance trade-offs
Downtime required, potential performance trade-offs

Amazon Web Services imposes a small hourly charge for unassociated Elastic IP (EIP) addresses within your AWS account. To reduce your monthly costs, Cloudthread recommends releasing any EIPs that are no longer needed.

EC2 Pricing

Need help reducing cloud cost waste?

Cloudthread can help

Nonstop cost optimization analysis
Group and attribute to owners
Embed in engineering workflows with Jira, Slack, GitHub integration
Attribute savings and track progress
Enter your email below and we'll reach out immediately
Thank you! Your submission has been received!
We will reach you soon!
Oops! Something went wrong while submitting the form. Please try again later!

Evaluation

Cloudthread Platform Instructions

Note: This will show you unused Elastic IP Addresses from across all accounts and all regions.

  1. Login to the Cloudthread platform and navigate to Opportunities Savings Explorer.
  2. Click the “Category” filter, check “Unused Elastic IPs”, and click OK.
Unused Elastic IPs

Console Instructions

Note: You’ll have to repeat the below steps for each account and region.

  1. Login to your AWS Management Console and navigate to the VPC dashboard.
  2. From the left-hand menu, select 'Elastic IPs' under the 'Network & Security' section.
Elastic IPs
  1. Look for the Association ID column.
Association ID
  1. You may notice some Elastic IP (EIP) addresses that are not currently associated with any running EC2 instances or Elastic Network Interfaces (ENIs). These unattached EIPs can be safely released to reduce unnecessary costs.
  2. Update the AWS region from the navigation bar and repeat the process for other regions to ensure that unassociated Elastic IP (EIP) addresses are identified and released across all regions in your AWS account.

CLI Instructions

  1. Open your terminal or command prompt.
  2. Ensure that you have the AWS CLI installed and configured with the appropriate credentials for your AWS account.
  3. Run the following command to list all the Elastic IPs in your AWS account:
 
 aws ec2 describe-addresses
 
  1. Examine the output to identify any Elastic IPs that do not have an associated EC2 instance or Elastic Network Interface (ENI). You can check the "InstanceId" and "NetworkInterfaceId" fields in the output to determine if an Elastic IP is attached or unattached.
  2. If an Elastic IP does not have an associated EC2 instance or ENI, it is unattached and can be released. To release an unattached Elastic IP, you can use the following command:
 
aws ec2 release-address --allocation-id 
 
 

Replace <ALLOCATION_ID> with the allocation ID of the unattached Elastic IP that you want to release.

  1. Repeat the above steps for other AWS regions, if needed, by updating the region using the --region command parameter value in the AWS CLI commands.

Action

Console Instructions

  1. Login to your AWS Management Console and navigate to the VPC dashboard.
  2. In the left navigation panel, under the Virtual Private Cloud section, choose Elastic IPs.
  3. Look for the Association ID column.
  4. Choose an unlinked Elastic IP address from the list, then click the Actions dropdown menu in the top menu of the dashboard, and choose Release Elastic IP Address.
Release Elastic IP addresses
  1. Review the unattached EIP(s) listed in the Release Address confirmation box, and click the Release button to remove the selected EIP(s) from your AWS account.
  2. To remove any unassociated EIPs in other regions, repeat steps 3-5 after changing the AWS region using the navigation bar.

CLI instructions

  1. Open your terminal or command prompt.
  2. Ensure that you have the AWS CLI installed and configured with the appropriate credentials for your AWS account.
  3. Run the following command to list all the Elastic IPs in your AWS account:
 
aws ec2 describe-addresses
 
 
  1. The output of the command should yield an array containing the metadata of all unassociated Elastic IP addresses (EIPs) in the specified region.
 
 [
    {
        "PublicIp": "18.214.64.132",
        "AllocationId": "eipalloc-0287c07cca688eb9a",
        "Domain": "vpc",
        "PublicIpv4Pool": "amazon",
        "NetworkBorderGroup": ""
    },
    {
        "PublicIp": "18.214.96.38",
        "AllocationId": "eipalloc-0a89fd84116786a5f",
        "Domain": "vpc",
        "PublicIpv4Pool": "amazon",
        "NetworkBorderGroup": ""
    },
    {
        "PublicIp": "18.233.20.135",
        "AllocationId": "eipalloc-0c8bbeb5dd93e74a2",
        "Domain": "vpc",
        "PublicIpv4Pool": "amazon",
        "NetworkBorderGroup": ""
    },
    {
        "PublicIp": "3.211.95.89",
        "AllocationId": "eipalloc-02646476a469723eb",
        "Domain": "vpc",
        "PublicIpv4Pool": "amazon",
        "NetworkBorderGroup": ""
    }
]
 
 
  1. Execute the release-address command with the EIP allocation ID as the identifier in order to delete any unassociated Elastic IPs that are present in the chosen region.
 
 aws ec2 release-address \\
–-region  \\
--allocation-id eipalloc-02646476a469723eb
 
 
  1. Perform step 5 again to release (remove) any remaining unattached Elastic IP addresses (EIPs) that are available in the chosen region.
  2. To free up any unattached EIPs that may be available in different AWS regions, simply follow the instructions and perform steps 1-6 again.
Make cloud costs a first class metric for your engineering organization.
Copyright © 2024 CloudThread Inc.
All rights reserved.