AWS provides 3 types of IP addresses: Private IP, Public IP, and Elastic IP. While Private IP addresses are used for internal communications within the VPC, Public and Elastic IPs allow establishing communication with the internet. One of the questions in that case is what differentiates the two if both provide access to the internet.
A Public IP address associated with an instance is not static and is lost when the instance is stopped, whereas an Elastic IP address is a static public address associated with your AWS account. This IP address is not lost when the instance with which it is associated is stopped and it remains allocated to your AWS account until you release it. The prime advantage of using Elastic IPs is that they can be moved or re-associated between instances and Elastic Network Adapters (ENAs).
In this article we will discuss 5 tips that one can follow when using Elastic IP addresses for their resources.
Release unused Elastic IP addresses
When allocating an Elastic IP address in your VPC make sure that you do only when you require one. AWS charges an hourly fee for Elastic IP that is not associated with any instance, or that is associated with a stopped instance or with a network interface that is not attached to any running instance.
If you do not require the Elastic IP anymore, dissociating it from the associated instance or network interface is not enough, you must also release the Elastic IP back to AWS.
Additional Elastic IPs are chargeable
Elastic IP addresses are not completely free of cost. An Elastic IP address associated with a running instance does not incur any charges, but if you want to associate more than one Elastic IP with that instance, then you will be charged for the additional Elastic IP addresses.
AWS also allows users to bring their ranges of IP addresses to AWS which is known as BYOIP (Bring Your Own IP addresses). In this case you are not charged for using IP from BYOIP pool.
Regional vs Global
In general, when allocating an Elastic IP address, make sure that it is allocated in the same region in which you are running the instance with which you want to associate the address, since Elastic IPs are regional.
In case you have a use case where you require global static IP addresses, use AWS’ Global Accelerator service. It provides two global static IP addresses when you create an accelerator.
Disassociating or Reassociating Elastic IP
Elastic IPs can be easily disassociated from one resource and reassociated with another resource. One must be careful when doing so. Make sure to track and update or remap the Elastic IP address mappings to avoid unavailability or unreachability issues with your services or resources with which the Elastic IP was associated.
In case you have DNS records mapping to the Elastic IP address that you want to disassociate or reassociate with another instance, make sure to delete or update the records appropriately.
Tagging your Elastic IPs
Tagging your infrastructure assets and resources is a good practice. It helps in not only organising and categorising, but also providing context and keeping track of the assets and resources.
AWS allows you to tag your Elastic IPs as well. Tags help in determining the context, purpose and category of the ELastic IP, so that users can keep track of where and for what purpose is the IP being used. Though at this point AWS does not support cost allocation tags for Elastic IPs.
An Elastic IP address is a static public IP address that you can associate with an instance or network interface in a particular region, until you choose to release it. Once it is attached to a running instance, you have the ability to access your instance over the internet. In this article we have tried to throw light on some of the essential things that one should know about when working with Elastic IPs so that users are able to make informed decisions about using the service and how it fits their use case.