How to Secure a Static IP for Your Amazon EC2 Instance with Elastic IP

Kacper Bąk
3 min readAug 6, 2023

Discover the steps to ensure your Amazon EC2 instance keeps a consistent IP address, making server management simpler and more effective.

Amazon Web Services (AWS) has positioned itself as the go-to cloud solution for diverse needs. One of its sought-after services, Amazon EC2, provides scalable computing capacity in the cloud. However, one common challenge that users encounter with EC2 instances is the changing IP address each time the instance is restarted. Enter Elastic IP — AWS’s solution to this very problem.

What is Elastic IP (EIP)?

Elastic IP (EIP) is a static, public IPv4 address designed for dynamic cloud computing. EIP allows you to mask the failure of an instance or software by rapidly remapping the address to another instance in your account.

Benefits of Using Elastic IP:

  1. Predictability: Always know the IP address of your instance.
  2. Flexibility: Quickly re-route your domain to a backup instance in case of maintenance or failure.
  3. Protection against failures: Mask failures by quickly remapping your public IP addresses.

How to Allocate and Assign an Elastic IP to Your EC2 Instance:

Log in to your AWS Management Console: Navigate to the EC2 Dashboard.

AWS Dashboard

Access Elastic IPs: On the left navigation pane, click on “Elastic IPs”.

AWS Dashboard Left Navigation Pane

Allocate: Hit the “Allocate Elastic IP address” button.

Elastic IP addresses dashboard

Then select “Allocate”. Your new Elastic IP will be generated.

Allocating Elastic IP address

Associate with Instance: Choose your new IP, then tap on “Associate Elastic IP address”.

Information about Elastic IP addresses

Pick your instance and the private IP to which you’d like to attach the Elastic IP.

Associating Elastic IP address

Finalize the Association: Click “Associate”, and voilà! Your EC2 instance now has a permanent public IP address.

Cost Implications:

Always be aware of AWS’s billing policies. AWS charges for each Elastic IP not associated with a running instance. Therefore, if you aren’t using a particular Elastic IP, it’s prudent to release it to avoid unnecessary costs.

In Conclusion

For businesses or individual projects relying on AWS’s EC2, using Elastic IP is an efficient way to maintain a consistent IP address, simplifying server and domain management. Whether you’re running a commercial website, a blog, or any digital platform, Elastic IP ensures your audience or clients can always find you at the same address.

--

--