Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security, Veeam & DevOps

  • Home
  • About
  • Advertise With US
  • Reviews
  • Tech News
  • Contact
  • Toggle search form

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
  1. Home
  2. AWS/Azure/OpenShift
  3. 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.

  • Share on X (Opens in new window) X
  • Share on Reddit (Opens in new window) Reddit
  • Share on LinkedIn (Opens in new window) LinkedIn
  • Share on Facebook (Opens in new window) Facebook
  • Share on Pinterest (Opens in new window) Pinterest
  • Share on Tumblr (Opens in new window) Tumblr
  • Share on Telegram (Opens in new window) Telegram
  • Share on WhatsApp (Opens in new window) WhatsApp
  • Share on Mastodon (Opens in new window) Mastodon
  • Share on Bluesky (Opens in new window) Bluesky
  • Share on Threads (Opens in new window) Threads
  • 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

  • Route53AWS
    Set up and configure Route 53 for your Domain in AWS AWS/Azure/OpenShift
  • Delete AWS EBS Volume
    How to delete an Elastic Block Store Volume on AWS AWS/Azure/OpenShift
  • AzureAD
    Azure Active Directory integration with on-premise AD using PTA AWS/Azure/OpenShift
  • Create AWS RDS instance
    How to create an Amazon Relational Database Service Instance AWS/Azure/OpenShift
  • Webp.net resizeimage 4
    Create, list, lock, deploy, and delete Azure Resource Group via Azure CLI AWS/Azure/OpenShift
  • How to Register Devices to Microsoft Intune and EntraID Using My Company Portal
    Register Devices to Intune and EntraID Using Company Portal AWS/Azure/OpenShift

More Related Articles

Route53AWS Set up and configure Route 53 for your Domain in AWS AWS/Azure/OpenShift
Delete AWS EBS Volume How to delete an Elastic Block Store Volume on AWS AWS/Azure/OpenShift
AzureAD Azure Active Directory integration with on-premise AD using PTA AWS/Azure/OpenShift
Create AWS RDS instance How to create an Amazon Relational Database Service Instance AWS/Azure/OpenShift
Webp.net resizeimage 4 Create, list, lock, deploy, and delete Azure Resource Group via Azure CLI AWS/Azure/OpenShift
How to Register Devices to Microsoft Intune and EntraID Using My Company Portal Register Devices to Intune and EntraID Using Company Portal 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

Veeam Vanguard

  • Disable BitLocker
    How to Disable BitLocker on Windows 10 Windows
  • elasticsearch error feature
    Elasticsearch: How to stop systemd service start operation from timing out Linux
  • Screenshot 2020 05 19 at 18.54.21
    Unable to find File Explorer in the Group Policy Editor when resolving the security tab missing under properties Windows Server
  • ansiblebanner
    Install and configure Ansible on Azure Virtual Machine Configuration Management Tool
  • Exchange Admin Centre   EMC
    How to grant Access to User Mailbox Network | Monitoring
  • Git not Recognized Image banner
    Fix Git is not recognised as an internal or external command Version Control System
  • images copy
    How to disable automatic screen lock in Ubuntu Linux Linux
  • change keyboard layout windows 10 thumb800
    How to use the On-Screen Keyboard 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,779 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

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

Copyright © 2026 TechDirectArchive

Loading Comments...

You must be logged in to post a comment.