2 min read | by Jordi Prats
Once you release an Elastic IP, it goes back to the pool for any other customer to use it. What do we do if we accidentally release an Elastic IP address? I shouldn't be hard for use to just pick a different IP and update the records accordingly if we are using IaC (terraform, pulumi, crossplane...)
However, sometimes there will be configuration relative to that particular Elastic IP out our control: third-party white listings would be a clear instance of this kind of situations. Can we request AWS to recover a released Elastic IP?
We might be able to recover it only if if haven't been allocated to another AWS account yet: Since it have been released, any AWS customer could claim it.
It must come to no surprise that we won't be able to recover any tags associated with it.
To actually requested to recover the Elastic IP we won't be able to find any option on the AWS Console, for this we can only use the AWS cli tool
First, we need to know the exact IP: Provided that it is important enough to try to recover it, it cannot be difficult to retrieve it from some DNS record. Once we have we will only need to run aws ec2 allocate-address as follows:
$ aws ec2 allocate-address --domain vpc --address 220.127.116.11
This procedure cannot be used to request specific IPs, it won't work if the IP didn't belong to the account you are using or if the Elastic IP have already been reassigned to some other account. You'll bet a message as follows:
$ aws ec2 allocate-address --domain vpc --address 18.104.22.168 An error occurred (InvalidAddress.NotFound) when calling the AllocateAddress operation: The Elastic IP address '22.214.171.124' does not exist or is not available.
Posted on 30/03/2022