How to override AssociatePublicIpAddress for an EC2 instance

随声附和 提交于 2021-02-20 03:00:59

问题


We have several EC2 instances that are in a private subnet, but gets a public IP address every time that instance is launched.

That private subnet has "Auto-assign Public IP" property set to No, but what happens is when instance was created, it got AssociatePublicIpAddress property set to true.

Now we don't know how to reset AssociatePublicIpAddress to false without terminating the instances.

I'd expect aws ec2 create-network-interface would have an option for that, but it's not the case.

EC2 C# API has a method to change that - see here, but we don't use that API. EC2 Console UI is clearly missing that, and we can't find anything in aws cli too. Any ideas how to modify AssociatePublicIpAddress to false for an existing instace?


回答1:


Unfortunately you cannot dissociate a public IP from an EC2 instance:

You cannot manually associate or disassociate a public IP address from your instance

We release the public IP address for your instance when it's stopped or terminated

You will have to terminate the instance in order to remove the public IP address.

Source



来源:https://stackoverflow.com/questions/41727460/how-to-override-associatepublicipaddress-for-an-ec2-instance

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!