英文:
Elastic IP Address is being dissociated after a restart
问题
我有一个具有关联的公共IP的EC2实例。
毫无原因,在重新启动后,此关联会丢失,我必须重新关联。
并非每次重新启动都会发生。
有任何建议吗?
英文:
I have an EC2 Instance with a Public IP associated.
For no reason, after a restart, this association is lost and I have to reassociate.
It doesn't happen for every restart.
Any tips?
答案1
得分: 2
有两种类型的公共 IP 地址可用于 Amazon EC2 实例:
- 一个 公共 IP 地址,它会从可用地址池中随机分配给实例。如果一个实例被 停止然后重新启动,它可能会获得不同的公共 IP 地址。(重新启动实例不会导致此情况发生,所以我怀疑您停止了实例而不仅仅是重新启动了它。)
- 一个 弹性 IP 地址,可以分配给您的账户。然后,该地址可以 分配 给 EC2 实例。IP 地址是静态的,因此不会更改。但是,如果需要,它可以 重新分配 给不同的 EC2 实例。它会一直与账户关联,直到被 释放。
如果您说您正在使用弹性 IP 地址,那么它应该一直与实例关联,直到明确取消关联。它不会在没有明确请求的情况下取消关联。如果正在取消关联,那么您可以使用 AWS CloudTrail 查找可能导致此情况发生的 API 调用。
英文:
There are two types of public IP addresses available for Amazon EC2 instances:
- A Public IP address that is randomly assigned to an instance from a pool of available addresses. If an instance is stopped and later started, it might receive a different public IP address. (Restarting an instance will not cause this to happen, so I suspect that you stopped your instance rather than merely restarted it.)
- An Elastic IP address that can be allocated to your account. The address can then be allocated to an EC2 instance. The IP address is static, so it will not change. However, it can be reassigned to a different EC2 instance if desired. It remains associated with the account until it is released.
If you are saying that you were using an Elastic IP address, then it should remain associated with the instance until specifically dissociated. It will not dissociate without a specific request. If it is being dissociated, then you could use AWS CloudTrail to look for the API call that would have caused this to happen.
答案2
得分: 0
在AWS EC2中,默认情况下,EC2实例不会分配静态的公共IP地址。
为了实现这一点,您需要首先生成一个静态IP地址,然后将其分配给您的EC2实例。这样,即使在重新启动之后,它也会保留分配的静态IP地址。
要执行此操作,请导航到EC2服务,从左侧菜单中选择'Elastic IPs'。单击“分配弹性IP地址”。这将生成静态IP地址。现在要将其分配给您的实例,请选中对新生成的IP地址的复选框,然后单击“操作”和'分配弹性IP地址'。
希望这有所帮助
英文:
In AWS EC2, By default the EC2 instances are not assigned with static public IP address.
For that, you will have to generate a Static IP address first and then assign it to your EC2 instance. In this way, even after the restart, it will retain the allocated static IP address.
To do this, Navigate to EC2 service, select 'Elastic IPs' from the left menu. Click on Allocate Elastic IP address. This will generate the static IP address. Now to allocate this to your instance, select the checkbox against the newly generated IP address, and click on Actions and 'Associate Elastic IP address'
Hope this helps
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论