+7 votes
in Amazon Web Service by

I have an AWS instance running behind an elastic IP. The instance also has a private IP address in my VPC. I will be re-assigning the elastic IP to another instance and am trying to re-assign the private IP as well. Note that the instance only has one private IP (no secondary).

Is this possible?

3 Answers

+8 votes

Unless this is a 'secondary private ip address' (and you said it was not), then no, you can't:

You can assign additional private IP addresses, known as secondary private IP addresses, to instances that are running in a VPC. Unlike a primary private IP address, you can reassign a secondary private IP address from one network interface to another. For more information about primary and secondary IP addresses, see Multiple IP Addresses in the Amazon EC2 User Guide for Linux Instances.


+5 votes

If you have an existing instance with the private IP you want (EXAMPLE: You should take an image (AMI) and then terminate that instance. Because it is in a VPC, just stopping it won't free the private IP.

Once you have a good image, terminate it. That would free up its Private IP Address. Thus you would have ( available

Then assign a secondary private IP to your new instance that you want and specify the private IP to be the one you want it to be (

To assign a secondary private IP to an existing instance

Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

In the navigation pane, choose Network Interfaces, and then select the network interface attached to the instance.

Choose Actions, and then select Manage Private IP Addresses.

In the Manage Private IP Addresses dialog box, do the following:

Choose Assign new IP.

Enter a specific IP address that's within the subnet range for the instance, or leave the field blank and we'll select an IP address for you.

(Optional) Select Allow reassignment to allow the secondary private IP address to be reassigned if it is already assigned to another network interface.

Choose Yes, Update, and then choose Close.

Note that alternatively, you can assign a secondary private IP address to an instance. Choose Instances in the navigation pane, select the instance, choose Actions, select Networking, and then select Manage Private IP Addresses. You can configure the same information in the dialog as you did in the steps above.

+1 vote

assign the same/old instance private ip to a new instance upon below conditions.

  1. creating a new instance on the same VPC as of Old instance
  2. terminate the old instance after taking AMI backup
  3. and you cannot assign private IP of old instance to new instance primary private IP after launching the instance.

Follow the below steps to Re-assign an old instance private IP to new instance primary private IP
1. Open EC2 dashboard.
2. Click on Launch Instance.
3. Then choose My AMIs on the left side tab and select your AMI.
4. Select the desired instance type.
5. Click on "Next :Configure Instance details".
6. Then select/provide the VPC ID and choose the subnet in network and subnet field respectively.
7. Select "disable" option in " Auto-assign Public IP" field of "Configure Instance" (which is third step of launching an instance)
8. In the same page, scroll down and click on Network Interfaces.
9. Then paste the required private IP in Primary IP field.
10. Add storage, configure Security group if required ( if you wish)
11. Click on Launch.

Welcome to Kloudwise, where you can ask any AWS, Azure, GCP and other cloud service questions and receive answers from other members of the community.