Whitepaper 'FinOps and cost management for Kubernetes'
Please consider giving OptScale a Star on GitHub, it is 100% open source. It would increase its visibility to others and expedite product development. Thank you!
Ebook 'From FinOps to proven cloud cost management & optimization strategies'
OptScale FinOps
OptScale — FinOps
FinOps overview
Cost optimization:
AWS
MS Azure
Google Cloud
Alibaba Cloud
Kubernetes
MLOps
OptScale — MLOps
ML/AI Profiling
ML/AI Optimization
Big Data Profiling
OPTSCALE PRICING
cloud migration
Acura — Cloud migration
Overview
Database replatforming
Migration to:
AWS
MS Azure
Google Cloud
Alibaba Cloud
VMWare
OpenStack
KVM
Public Cloud
Migration from:
On-premise
disaster recovery
Acura — DR & cloud backup
Overview
Migration to:
AWS
MS Azure
Google Cloud
Alibaba Cloud
VMWare
OpenStack
KVM

How to release Elastic IPs on Amazon EC2

Problem statement: Elastic IPs are free of charge only in certain cases

Let’s begin this article by identifying two types of IP addresses that can be assigned to Amazon EC2 instances – private and public addresses. Private IP addresses are responsible for the communication between internal AWS services and resources in a single VPC, whereas public IP addresses can be additionally attached to instances in order to establish external connections, and enable Internet communication. These public IPv4 IP addresses are called Elastic IP addresses (EIP). The huge advantage of using this type of IP address lies in a simple remapping of this IP to a different machine if that is indeed required. From an outsider’s point of view, there will be no difference for the end-users, they will still use the existing public IP.

To assign an EIP to an AWS instance, you need to allocate it first. In general, Elastic IP addresses are free of charge, but only when the following rules are applied:

  • EIP is assigned to an EC2 instance
  • The instance is running
  • The instance has only one EIP attached
  • EIP remapping is limited to 100 times per month

However, if the Elastic IP doesn’t meet one of the rules mentioned above, you will be charged at the following rates:

  • $0.005 per additional Elastic IP address associated with a running instance, per hour, on a pro rata basis
  • $0.005 per Elastic IP address not associated with a running instance, per hour, on a pro rata basis
  • $0.10 per Elastic IP address remap for additional remaps, over 100 per month

Keeping an eye on all active cloud resources is not an easy task, therefore, in order to get your resources organized and manageable, we highly recommend tagging them. Discover the rules, appropriate to your team, and tag all the resources, including EIP addresses to minimize the risk of losing them.

How to release EIPs

Before releasing an elastic IP, select that this address is not associated with any AWS resources; such as an EC2 instance, NAT gateway, or Network Load Balancer; otherwise, you will not be able to release it.

From AWS console:

Go to the EC2 service and click on Elastic IPs in the left menu to observe the addresses of the specific region. 

To release the IP, simply select it in the list, click on Actions → Release Elastic IP addresses, as below:

Elastic IP addresses Amazon EC2

From AWS CLI:

A programmatic way to operate the resources delivers much broader capabilities, therefore, you have a choice whether you want to release a specific IP or find all unused IPs and remove them at once.

Depending on the AWS EC2 platform that you use to launch the instances, select an appropriate command to find and release EIP in all regions:

EC2-Classic

aws ec2 describe-addresses --query 'Addresses[].[PublicIp,AssociationId]' --output text | \ awk '$2 == "None" { print $1 }' | \ xargs -I {} aws ec2 release-address --public-ip {}

EC2-VPC

aws ec2 describe-addresses --query 'Addresses[].[AllocationId,AssociationId]' --output text | \ awk '$2 == "None" { print $1 }' | \ xargs -I {} aws ec2 release-address --allocation-id {}

Note:
If you use EC2-Classic, you can use the aws ec2 release-address --public-ip command to release a specific elastic IP, otherwise you must use aws ec2 release-address --allocation-id eipalloc-76f5890b

Find our recent article ‘How to tag resources in the AWS Management Console’ here → https://hystax.com/how-to-tag-resources-in-the-aws-management-console

Enter your email to be notified about new and relevant content.

Thank you for joining us!

We hope you'll find it usefull

You can unsubscribe from these communications at any time. Privacy Policy

News & Reports

FinOps and MLOps

A full description of OptScale as a FinOps and MLOps open source platform to optimize cloud workload performance and infrastructure cost. Cloud cost optimization, VM rightsizing, PaaS instrumentation, S3 duplicate finder, RI/SP usage, anomaly detection, + AI developer tools for optimal cloud utilization.

FinOps, cloud cost optimization and security

Discover our best practices: 

  • How to release Elastic IPs on Amazon EC2
  • Detect incorrectly stopped MS Azure VMs
  • Reduce your AWS bill by eliminating orphaned and unused disk snapshots
  • And much more deep insights

Optimize RI/SP usage for ML/AI teams with OptScale

Find out how to:

  • see RI/SP coverage
  • get recommendations for optimal RI/SP usage
  • enhance RI/SP utilization by ML/AI teams with OptScale