Can I remove the public IP address on my instance without interrupting it?

I have several instances on vpc that communicate with each other through their personal ips. Each instance was launched sometime earlier and assigned a random public IP address that is not used for anything. Since everything that is publicly accessible is a vulnerability and they are not used at all, I would like to remove them.

Is it possible to delete public IP addresses without terminating the instance?

+12
source share
3 answers

No, this is not possible without completing the instance. If it was Elastic Ip, then it would work.

The only option is to take the instance AMI, terminate the instance, and run AMI in the VPC without including the public IP address for that instance.

Once you complete the instance using this private IP address, you can again assign this private ip to the new instance that you created from Image. (As long as it is on the same VPC and subnet) Thus, you do not need to update the private IP addresses of all "vpc instances that communicate with each other through their personal ips"

+7
source

Yes, you can remove the public IP address from the instance.

This applies when your instance was launched on a subnet with the option "automatically assign public IP". This adds a public IP address that is difficult to remove.

Notes:

  • If you change the subnet setting, stop and start the instance, it will not affect. Public IP remains.
  • If you obtained your public IP address by associating an elastic IP address, then it will be different, all you have to do is right-click on the instance or Elastic IP address and select "Network", "Disable elastic IP address").

There is a failure solution here that works first, but the public IP address is returned (like another address) when the instance is restarted.

Solution: (detailed steps below)

First you need to add another network interface, and then release the public address by adding and removing an elastic IP address.

Here is a detailed walkthrough:

  1. Create a new network interface.
  2. Attach the new network interface to your instance.
  3. Create a new Elastic IP (in the EC2 console).
  4. Right-click the new EIP and associate it with the instance whose public IP you want to delete.
  5. Now do the opposite, cancel the EIP that you just added. At this point, right-click the instance and select "Network", "Manage IP Addresses", and you will see that there is currently no public IP address. You must update the instance view, otherwise it will not appear.

If you stop and start the instance now, the public IP address will no longer appear.

  1. Remove: remove the elastic IP that you created earlier. Do not remove the new optional network interface. This should remain in place. If you delete the new / second NI, then the public IP will return the next time you stop and start the instance.

I know this sounds a little strange, but in the AMC documentation here and I checked it and it works. Relevant quote from this page: "If the public IP address of your instance in the VPC has been released, it will not receive a new one if more than one network interface is connected to your instance."

0
source

This is a very old thread, but the easiest way to remove the public ip associated with the VPC settings is:

  • create elastic IP
  • assign an elastic ip to the owner owning the public ip that you want to free (ip is released in this step)
  • disconnect the ip address from the elasic ip management screen.
-one
source

All Articles