Home > Blockchain >  How to disable public IP for an existing EC2 instance
How to disable public IP for an existing EC2 instance

Time:06-08

I have a group of EC2 instances associated with different security groups, let's say a private-security-group and a public-security-group. I have set up a VPN running on an EC2 instance with it's own security-group. I have configured my instances in such a way that:

  • The instances associated with the private-security-group are accessible through the VPN tunnel
  • The instances associated with the private-security-group are accessible by other instances associated with the public-security-group

This means that no inbound traffic can reach out to the instances from the internet. For that reason, I would like to remove the public IP address that is automatically allocated to those instance as a next layer of security so that I would have a series of instances running on a private network (but I may need access to the internet occasionally).

The main problem here is that I cannot recreate those instances as it will be very time consuming. How can I remove the automatically assigned public IP that is attached to a running instance?

CodePudding user response:

You can't delete it once it is associated with the instance. From docs:

You cannot manually associate or disassociate a public IP (IPv4) address from your instance.

You have to re-recreate your instances without public ip.

  • Related