Posted on

AWS Elastic IP

AWS dynamically changes the public IP address of an EC2 Instance when the instance is restarted.

As such in order to have the same IP address when an EC2 Instance is restarted it is necessary to have an AWS Elastic IP Address. An Elastic IP address is a public IPv4 address which can be attached to a single EC2 instance at any one time and is associated with an AWS account until it is deleted.

One use case for an Elastic IP address is to easily remap to a different EC2 instance if one EC2 instance should fail. However due to there being a 5 Elastic IP limit for your AWS account this is not a common pattern.

Best practice is to avoid using Elastic IP Addresses all together and instead register a DNS name (See Route 53).

Alternatively use an AWS Load Balancer and do not use a public IP address at all.