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:
- Create a new network interface.
- Attach the new network interface to your instance.
- Create a new Elastic IP (in the EC2 console).
- Right-click the new EIP and associate it with the instance whose public IP you want to delete.
- 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.
- 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."
source share