Aws Elastic IP :
Aws provide a functionality so that you can reserve the public IP. You can utilize that public ip to attach with ec2 instances.
How it is useful :-
When you launch an instance with default configuration, a public IP is associated with that instance. You can access different services running on different port if allowed in security group utilising internet.
Let’s say you setup the apache to host a website.
Now, you need to scale up that machine due to any reason or you need to move that machine into another reason , you need to stop that machine.
Whenever you restart again, the public ip from associated with that machine can also change.
So it may be the case that you need to update all DNS entries again.
However, You can reserve the public ip for you and that ip can be attached to any ec2 which you have, so there will be no issue regarding PUBLIC IP Change.
Step1: Go to EC2 > Elastic Ip Address
Step-2 :- Click on Allocate Elastic Ip Address
Step-3: – IP Address Allocated, Now you just need to associate it with any instance you wish.
Click on Action , and then associate IP address.
Step-4: Associate Ip Address
You can check EC2 dashboard to know that which instance has Elastic Ip Address. IF this is in blue and clickable it means this is Elastic IP address and by clicking on that you can navigate to the Elastic IP.
And You know about the cost.
How much do Elastic IPs cost? Elastic IPs are totally free, as long as they are being used by an instance. However, Amazon will charge you $0.01/hr for each EIP that you reserve and do not use. You will be charged if you ever remap an EIP more than 100 times in a month.
For more about Elastic IP