如何为EC2实例覆盖AssociatePublicIpAddress [英] How to override AssociatePublicIpAddress for an EC2 instance

查看:104
本文介绍了如何为EC2实例覆盖AssociatePublicIpAddress的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有几个EC2实例位于专用子网中,但是每次启动该实例时都会获得一个公共IP地址.

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

该专用子网的自动分配公用IP"属性设置为否",但是发生的是在创建实例时,它已将AssociatePublicIpAddress属性设置为true.

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.

现在,我们不知道如何在不终止实例的情况下将AssociatePublicIpAddress重置为false.

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

我希望 aws ec2 create-network-interface 可以为此选择一个选项,但事实并非如此.

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

EC2 C#API具有一种更改方法-请参阅这里,但我们不使用该API.EC2控制台用户界面显然缺少这一点,我们也无法在aws cli中找到任何内容.有任何想法如何针对现有实例将AssociatePublicIpAddress修改为false吗?

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?

推荐答案

不幸的是,您无法将公共IP与EC2实例解除关联:

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

您不能手动将公共IP地址与您的实例相关联

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

在实例停止或终止时,我们会为您的实例释放公共IP地址

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

您必须终止实例才能删除公共IP地址.

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

来源

这篇关于如何为EC2实例覆盖AssociatePublicIpAddress的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆