It’s important to understand Elastic IPs and Elastic IP pricing on Amazon Web Services (AWS) because you can still be billed for Elastic IP charges even when you’re not using them. In this article, we outline what Amazon Elastic IP addresses are, how Elastic IP pricing works, and a solution to identify unattached Elastic IPs to reduce unnecessary costs.
Public and private IP addresses with Amazon EC2 instances
When you launch an EC2 instance on AWS, the instance is automatically assigned a private IP address and (depending on the subnet/VPC settings) a public IP address. The private IP address is assigned so the instance can communicate with other AWS services and other instances within the same private network, and the public IP address is assigned so the instance can communicate with the internet.
The public IP address assigned to the instance is a dynamic IPv4 IP address from Amazon's pool of public IP addresses. The dynamic IPv4 IP address is free to use, but as soon as the instance is stopped or terminated, the address is automatically released back into the pool and you're unable to reuse it. When you restart the instance, a new dynamic IPv4 IP address is assigned to it.
This can create an issue inasmuch as the public IP address is the address used by the internet to direct web traffic to your instance in the same way your physical address is used by the postal service to deliver mail. If a new dynamic IPv4 IP address is assigned to the instance each time it is stopped and restarted, it makes it nearly impossible for the internet to find the EC2 instance.
What are Amazon Elastic IP addresses?
Amazon Elastic IP addresses are static public IPv4 IP addresses that remain assigned to EC2 instances regardless of their state. The “elasticity” of the IP address enables businesses to stop EC2 instances and transfer the IP address to another EC2 instance—or direct traffic to a second instance if a first instance fails—so that the internet can continue to direct web traffic to the right destination.
A second benefit of using an Elastic IP address is that it’s “clean.” Auto-assigned public IP addresses come from a pool of IP addresses used by EC2 instances, and the scenario exists that a business’ newly launched instance could inherit web traffic from the IP address' previous owner. By assigning an Elastic IP address to the newly launched instance, that scenario won't occur.
Due to there being a finite number of public IPv4 addresses available, AWS limits the number of Elastic IP addresses a business can reserve to five per region per Virtual Private Cloud (VPC). This limit can be increased on request, provided there’s a good reason, and provided the number of VPCs per region multiplied by the number of security groups per VPC does not exceed ten thousand.
An explanation of AWS Elastic IP pricing
AWS Elastic IP pricing varies depending on a few conditions. Businesses can have a single Elastic IP address assigned to a running EC2 instance for free. Businesses only incur Elastic IP pricing charges if one of the following occurs:
- The business assigns additional Elastic IPs to the same instance
- The instance associated with the Elastic IP address is stopped or terminated
- If the IP address is unattached from the network interface, such as the Network Load Balancer or NAT gateway
- If the Elastic IP address is re-mapped more than one hundred times per month
Additional IP addresses and IP addresses not applied to a running instance currently incur an Elastic IP pricing charge of $0.005 per hour on a pro-rata basis. And an Elastic IP pricing charge of $0.10 is incurred for each re-map after the one hundred limit is reached.
Although individually AWS Elastic IP pricing isn't expensive, each unattached Elastic IP address (or IP address assigned to a stopped instance) wastes $3.60 of a business’s budget per thirty-day month. Over the course of a year, that amounts to $43.20, and, if a business fails to maintain control of the number of Elastic IP addresses being used, it’s not difficult to see the figure increasing into thousands of dollars.
How to maintain control of Elastic IP costs
You can use the AWS Console to help identify any unattached/disassociated Elastic IPs. However, this process can be time-consuming and manual, especially for customers with hundreds of thousands of resources distributed across various regions.
Maintaining control of Elastic IP costs is a simple two-step process with CloudHealth. The first step involves running the CloudHealth Rightsizing Report in order to identify unattached Elastic IPs and release them. The second step is to apply a policy to notify system administrators when an Elastic IP address has remained attached for a defined period of time. The notification enables administrators to investigate why an IP address is unattached and either reassign it or release it as appropriate. As a best practice, monthly Elastic IP charges should be as close to zero as possible.
This process can be replicated to identify and terminate any zombie assets in your AWS environment—including unattached EBS volumes, aged snapshots, idle load balancers, and more—potentially saving you thousands of dollars on your monthly cloud bill. If you’d like to know more about maintaining control of Elastic IP pricing on AWS and reducing unnecessary costs elsewhere in your cloud infrastructure, our team of cloud cost optimization professionals would be happy to guide you through the cost-saving benefits of CloudHealth. Feel free to reach out to us here.
Elastic IP pricing on AWS FAQs
Is there such a thing as an Elastic IP free tier?
Because the first initial Elastic IP address is free, and because there is a limited supply of IP addresses in the pool of IP addresses, Amazon does not offer an Elastic IP free tier.
What is the difference between Public IP addresses and Elastic IP addresses?
Public IP addresses are dynamic, which means if you stop and restart an instance, the public IP address that was first associated with the instance is released back into Amazon's pool of public IP addresses and your instance is assigned a new public IP address once it is restarted.
Elastic IPs are static, which means it will remain assigned to the instance regardless of the instance's state. This is helpful for directing traffic to the correct place, but can incur costs if you stop or terminate your instance and forget to release the Elastic IP address that was associated with it.
What does an AWS static IP cost?
AWS static IP addresses are the public IPv4 “Elastic” IP addresses mention above that remain assigned to EC2 instances regardless of their state. AWS static IP addresses are therefore just another way of saying “AWS Elastic IP addresses,” and the cost of the AWS static IP address is the cost of the AWS Elastic IP address.
What happens to my Private, Public, and Elastic IP addresses when I terminate, stop, or stop and restart an EC2 instance?
Terminate the instance: Both the Public and Private IP addresses are released. If the EC2 instance is designated with an Elastic IP address (rather than a standard Public IP address), then the Elastic IP address is disassociated and will continue to incur charges. To avoid paying for what you're not using, you can either reassign the Elastic IP to a different instance or release it.
Stop the instance: The Private IP address remains the same. The existing Public IP address is released from the instance. If the instance is designated with an Elastic IP address (rather than a standard Public IP address), then the Elastic IP/Public IP address will remain the same and you will continue to be charged for the Elastic IP address.
Stop and restart the instance: On restart of the instance, the Private IP address remains the same and a new Public IP address is assigned. If the EC2 instance is designated with an Elastic IP address (rather than a standard Public IP address), then the Elastic IP/Public IP address will remain the same.
Is trying to reduce AWS Elastic IP cost worth the effort?
Even though the individual costs of unattached, unused, and re-mapped Elastic IP addresses are small, if a search of your cloud environment found five hundred unattached IP addresses that could be released into the pool, that's $1,800 dollars a month in cloud spend saved. For the amount of effort involved, trying to reduce AWS Elastic IP costs is definitely worth it.
For more best practices on reducing cloud spend in AWS, we recommend you check out the following resources: