I recently created an AWS EC2 Instance and it had an IP address like 3.144.nnn.nnn
.
I used that IP address for an application as my IP address and there is no way I can change it. After stop and start of Instance, I get a random IP address.
Then I found I can allocate static IP address with Elastic IP address.
However, when I try to allocate the Elastic IP it also generates random IP, so I tried this with the AWS CLI:
aws ec2 allocate-address --address 3.144.nnn.nnn --domain vpc
(with the same IP above)
But it returns an error:
An error occurred (InvalidAddress.NotFound)
when calling the AllocateAddress operation:
The Elastic IP address '3.131.nnn.nnn' does not exist or is not available.
I tried with several IPs with the same range( for test purposes). However, it returns the same error.