I thought of writing this blog because I have a personal AWS account which I generally use for learning purposes but a couple of months ago assigned the Elastic IP address to one of my experimental EC2 accounts and forgot about deleting the EC2 instance as well as releasing(deleting) Elastic IP address.
Although I have used t2.micro EC2 instance but still, I have to pay for the price of Elastic IP which I was using along with other resources.
Why do you want to release(delete) Elastic IP?
Cost - To avoid being charged for Elastic IP addresses that are not in use. AWS charges for Elastic IP addresses that are not associated with a running instance. If you have Elastic IP addresses that are not being used, you can release them to avoid being charged for their use.
AWS puts a limit on the number of Elastic IP - To free up Elastic IP addresses for use with other instances. AWS limits the number of Elastic IP addresses that you can associate with your account. If you have reached this limit and need to associate additional Elastic IP addresses with your instances, you will need to release some of your existing Elastic IP addresses first.
- To make a change in Network Interface - To make changes to the network configuration of your instances. In some cases, you may need to release an Elastic IP address and then re-associate it with the same or a different instance in order to make changes to the network configuration of your instances.
Why Elastic IP address is important?
Elastic IP is very important in AWS because it will provide you static and stable IP address for your EC2 instance.
It is basically used to overcome the disadvantages of public IP that is IP get changed once server stop and then start.
So it is a static public IP that will not changed when you stop and start your ec2 instance.
But again AWS will cost you if this IP is not associated to any of the AWS resources.
How to delete Elastic IP address from AWS console
Please follow below steps to release the IP address from AWS_
Step1:- Go to the AWS console and search EC2 instance service. On the left side panel you will get Network and Security --> Elastic IP
Step2:- Select the Elastic IP whichever you want to release and go to the Action tab and select Release Elastic IP Address
If you find Release Elastic IP Address tab is disabled, Please refer to the next section to find and delete NAT Gateway before deleting Elastic IP address.
How to delete NAT Gateway if Release Elastic IP Address tab is disabled for you
Step1:- Go to the AWS console and search for VPC service. On the left side panel you will get NAT gateway.
Step2:- Select the NAT gateway which is associated with your Elastic IP
Step3:- Once you select the NAT gateway go to the Action tab and click on Delete NAT gateway.
Step4:- After deleting the NAT gateway you will able to see Release Elastic IP Address.
Conclusion
Elastic IP addresses in AWS serve the important purpose of allowing users to easily associate a static IP address with their EC2 instances. The process for releasing an Elastic IP address is simple and can be performed through the AWS Management Console as well as AWS CLI
Releasing an Elastic IP address has the potential benefit of optimizing the performance and cost-efficiency of your AWS environment, as it allows you to reclaim unused IP addresses and prevent them from accruing unnecessary charges. I recommend that users carefully consider their need for Elastic IP addresses and release any unused addresses to optimize their AWS environment.