Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Reviews
  • Contact
  • Toggle search form
Home » AWS/Azure/OpenShift » How to Allocate, Associate, Disassociate and Release Elastic IP Address from an EC2 Instance
  • Machine does not support XSAve
    How to disable side-channel mitigations on VMware Workstation Virtualization
  • Screenshot 1
    Migrating SAP HANA Plugin to Veeam Backup
  • stuck
    Fix Hyper-V VM Stuck in Stopping State Virtualization
  • Windows Admin Center Apply Update
    How to Apply and Enable Automatic Windows Admin Center Update Windows
  • On ubuntu mariadb
    How to install MariaDB on Ubuntu Linux
  • DevOps GIT Docker Kubernetes
    Azure DevOps: Docker and Kubernetes Deployment with GitHub AWS/Azure/OpenShift
  • Troubleshooting Synology NAS Domain Join 2
    Synology NAS Domain Join: The Importance of DNS Configuration Reviews
  • screenshot 2020 05 05 at 10.26.12
    How to enable or disable User Account Control Windows

How to Allocate, Associate, Disassociate and Release Elastic IP Address from an EC2 Instance

Posted on 10/02/202319/12/2023 Imoh Etuk By Imoh Etuk No Comments on How to Allocate, Associate, Disassociate and Release Elastic IP Address from an EC2 Instance
EC2-Public-IP

In this post, I will show you how to Allocate and Associate or Disassociate and Release ELastic IP to an EC2 instance. First of all, let’s take a look at why this is necessary. IPv4 and IPv6 addressing protocols are supported by Amazon EC2 and Amazon VPC. Amazon VPC uses the IPv4 addressing protocol by default; you cannot change this behaviour. Please see How to sync S3 Bucket with an EC2 instance, and Quick Steps in Setting Up AWS VPC

You must specify an IPv4 CIDR block when creating a VPC (a range of private IPv4 addresses). You can optionally assign an IPv6 CIDR block to your VPC and assign IPv6 addresses to instances in your subnets from that block. When we talk about IP Address, it comes in two types that is, Private and Public IP Address.

Private IPv4 addresses enable instances within the same VPC to communicate, facilitated by DHCP for distributing these private addresses. Meanwhile, public IP addresses, accessible over the Internet, support communication between instances and the broader online network.

To enable public accessibility from the internet, EC2 instances typically receive at least one public IP address upon creation. However, if you encounter an error, such as the one below, when attempting to connect to the instance, you must manually allocate an IPv4 address to it.

The instance does not have a public IPv4 address. To connect using the EC2 Instance Connect browser-based client, the instance must have a public IPv4 address.

Why do we need to Assign an Elastic IP Address to an EC2 Instance?

Reason 1 – You could do this if you receive an error similar to the one in the below screenshot when trying to connect to your EC2 instance.

The-instance-does-not-have-a-public-IP
No Public IP Address Assigned

Reason 2: You may also need to do this if you want to assign a static IPv4 address to your EC2 instance, as the public IP address that’s auto-assigned to your EC2 instance changes every time you stop and start the instance.

Assigning a static IP address to your Windows or Linux EC2 instance allows the instance to preserve its IP address after a stop-and-start process.

Keep the following points in mind when working with static IP addresses:
- When you associate an Elastic IP address with an instance, its current public 
  IPV4 address is released back into Amazon's pool of public IPv4 addresses
- You can't reuse a public IPv4 address
- You can't convert a public IPv4 address to an Elastic IP address

The resolution for this is to use an Elastic IP address, first allocate the address to your account, and then associate the address with your instance or a network interface. 

Refer to the following posts to learn more: How to add an EBS volume to AWS EC2 via the AWS Console and CLI, How to Add a New Virtual Disk to an EC2 Instance and Format the Drive,

Prerequisites:

To follow along in the demonstration, the following things are required:

  1. An AWS Account with an active subscription. If you don’t have an account yet, you can sign up here for the free tier account.
  2. An IAM User account with permission to manage EC2 instances and VPC resources. Caution, don’t use the root account on a regular basis because it is the account with full access to all your AWS Resources.

If you have the above requirements, proceed with me to the demonstration tasks below.

Allocating an Elastic IP Address

Step 1 – To allocate a Elastic IP address to an existing EC2 instance, log in to the AWS Management Console

AWS-Management
AWS Management Console

Step 2 – Navigate to the EC2 Console, in the navigation pane, choose “Network and Security,” and then choose Elastic IPs. Select “allocate an elastic IP address” in the top-right corner of the screen. 

Allocate-Elastic-IP-Address
Allocating Elastic IPs

Step 3 – Select Amazon’s pool of IPv4 addresses. Choose this option if want an IPv4 address that’s allocated from Amazon’s pool of IPv4 addresses.  Choose other options if you have a custom IP address you want to bring to your AWS Account.

Select-Amazons-Pool-of-IPv4-addresses
Allocating Elastic IP Address

Step 4 – Click on Allocate

Click-on-Allocate
Allocate the IP Address

After that, you will get a successful message prompt that the IP address has been successfully allocated.

Elastic-IP-address-successfully-created
Successfully Allocated

Associating Elastic IP Address to your EC2 Instance

Next is to associate the IPv4 address we have just allocated from Amazon’s pool of IPv4 addresses to our EC2 instance.

To associate, you can do this directly from the immediate screen displaying a successful prompt of IP address allocation or you go into the EC2 instance console and locate the “Action” tab and implement it.

Let’s take the following steps to do it:

Step 1– From the EC2 Console, locate Network and Security and then click on Elastic IPs.

Click-on-Network-and-Security-1
Associating IPv4 Address

Step 2 – Click on the Action tab, and select Associate Elastic IP address

Click-on-Associate-IP
Associating Elastic IP Address

Step 3 – In the Associate Elastic IP address console, make sure the Instance under the Resouce type is checked and the EC2 instance you want to associate the IP address to and its Id is selected.

Associating-Elastic-IP-address
Selecting the Instance to Associate IPv4 Address

Next, proceed to click on Associate.

Choose-Associate
Associating Elastic IP Address

Now the prompt that you have successfully associated the IPv4 address to the EC2 instance displays.

IP-Address-Associated-successfully

If you navigate to the connect page for the EC2 instance, you will no longer receive the error that the instance doesn’t have a public IPv4 address anymore. Go ahead and connect to your EC2 instance.

Go-ahead-and-connect-to-EC2-Instance
You-will-now-see-the-IP-Address

Disassociating Elastic IP Address from an EC2 Instance

If your EC2 Instance keeps running or stops you will still incur charges, as far as Elastic IP addresses or EBS volumes are attached to the instance.

One of the ways you are able to release the Elastic IP Addresses back to Amazon to save cost is to disassociate it from an instance.

To disassociate the Elastic IP address, follow the below steps:

Step 1 – Navigate to the Running Instance Console, click on the Action tab, then Network and click on Disassociate Elastic IP Address.

Disassociate-Public-IP
Disassociating Elastic IP Address

Step 32 – Click on Disassociate Elastic IP Address

Click-on-Disassociate-Elastic-IP-Address
Disassociate Elastic IP Address

Step 3 – Type “proceed” when prompted to confirm the disassociation.

Confirm-Disassociation
Confirming the Elastic Disassociation

Elastic IP Address disassociation successful.

Disassociation-successful
Elastic IP Address Disassociated

Releasing Elastic IP Address

AWS recommend that you release an Elastic IP address if you no longer require it. You are charged for any ç that is assigned to a VPC but is not associated with an instance.

So the best way to save cost is to release the Elastic IPv4 address back to Amazon’s pool of IPv4 addresses. Take the following steps to release the IPv4 address:

Step 1 – Navigate to the Elastic IPv4 Address console, select the IP address and click on the Action tab, and then

Release-IP-Address1
Releasing Elastic IP Address

Step 2 – Click on Release to release the IP address

Releasing-The-IP12
Releasing IP Address

Finally, the successful screen shows up:

Elastic-IP-Address-Released
Elastic IP Address Released

I hope you found this article useful on how to Allocate, Associate, Disassociate and Release Elastic IP Addresses from an EC2 Instance. Please feel free to leave a comment below.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
AWS/Azure/OpenShift Tags:AWS VPC, EC2 instance, IP Address

Post navigation

Previous Post: Run Python Script via Windows Task Scheduler
Next Post: Set up Cross-Region Replication for S3 Buckets

Related Posts

  • Move Resources On Azure
    Move Azure Resources between Subscriptions AWS/Azure/OpenShift
  • Create an S3 Bucket
    Backup Repository: How to Create Amazon S3 buckets AWS/Azure/OpenShift
  • Azure VMware Solution Private Cloud
    How To Deploy Azure VMware Solution Private Cloud AWS/Azure/OpenShift
  • Convert PEM to PPK 1
    Convert a PEM Key to a PPK Key on a Linux and Windows AWS/Azure/OpenShift
  • images 2 1
    How to create an AMI using AWS console AWS/Azure/OpenShift
  • image 12
    How to Use Postman with the Amazon Pinpoint API AWS/Azure/OpenShift

More Related Articles

Move Resources On Azure Move Azure Resources between Subscriptions AWS/Azure/OpenShift
Create an S3 Bucket Backup Repository: How to Create Amazon S3 buckets AWS/Azure/OpenShift
Azure VMware Solution Private Cloud How To Deploy Azure VMware Solution Private Cloud AWS/Azure/OpenShift
Convert PEM to PPK 1 Convert a PEM Key to a PPK Key on a Linux and Windows AWS/Azure/OpenShift
images 2 1 How to create an AMI using AWS console AWS/Azure/OpenShift
image 12 How to Use Postman with the Amazon Pinpoint API AWS/Azure/OpenShift

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • Machine does not support XSAve
    How to disable side-channel mitigations on VMware Workstation Virtualization
  • Screenshot 1
    Migrating SAP HANA Plugin to Veeam Backup
  • stuck
    Fix Hyper-V VM Stuck in Stopping State Virtualization
  • Windows Admin Center Apply Update
    How to Apply and Enable Automatic Windows Admin Center Update Windows
  • On ubuntu mariadb
    How to install MariaDB on Ubuntu Linux
  • DevOps GIT Docker Kubernetes
    Azure DevOps: Docker and Kubernetes Deployment with GitHub AWS/Azure/OpenShift
  • Troubleshooting Synology NAS Domain Join 2
    Synology NAS Domain Join: The Importance of DNS Configuration Reviews
  • screenshot 2020 05 05 at 10.26.12
    How to enable or disable User Account Control Windows

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,839 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.