In this post I’ll assign an Elastic IP to my Exam_CSAA_Maarek_3 EC2 instance. I stopped the instance last time to reduce charges:

AWSB0010-01_EC2Stopped

Note there is no Public IP listed. Starting the instance allocates a new IP address:

AWSB0010-02_EC2Started

And while rebooting the instance doesn’t change this, stopping and starting it again attaches another completely different IP:

AWSB0010-03_EC2Restarted

Depending on what the instance is being used for this could cause issues. To combat this, AWS allow Elastic IPs to be assigned to instances. This is available on the EC2 dashboard under Network & Security > Elastic IPs. After choosing to allocate an address from Amazon’s pool I am presented with my new Elastic IP:

AWSB0010-04_ElasticIP

I’ll now associate the Elastic IP with my instance. I right-click on the IP and choose Associate Address, then choose the EC2 instance from the list presented:

AWSB0010-05_ElasticIPAssign

The Elastic IP dashboard then updates with the EC2 instance’s ID:

AWSB0010-06_ElasticIPLinked

And on the EC2 dashboard the IP address has changed again, this time to match the Elastic IP:

AWSB0010-07_EC2ElasticIP

The instance can now be stopped and stared as often as needed - the IP will stay the same.

My final actions will be disassociating the Elastic IP address from the instance via the Networking options available from right-clicking on the instance, and then releasing the Elastic IP address itself back to Amazon. This is to prevent unnecessary charges - at time of writing, Elastic IP address doesn’t incur charges as long as the following conditions are true:

  • The Elastic IP address is associated with an EC2 instance
  • The instance associated with the Elastic IP address is running
  • The instance has only one Elastic IP address attached to it

AWS charge by the hour for each Elastic IP address that doesn’t meet these conditions.

Thanks for reading ~~^~~