重启后EC2实例的IP地址发生变化 [英] An IP address of EC2 instance gets changed after the restart

查看:26
本文介绍了重启后EC2实例的IP地址发生变化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行一个 EC2 Linux 实例.出于某些维护目的,我关闭了实例并再次启动它.但是,EC2 IP 现在已更改.

I am running an EC2 Linux instance. For some maintenance purposes I shutdown the instance and started it again. However, EC2 IP has changed now.

如何让Amazon EC2实例停止并重新启动后保持IP地址不变?

How to keep an IP address of Amazon EC2 instance unchanged after stop and start it again?

推荐答案

实际上,当您停止/启动您的实例时,IP 地址会发生变化.如果您重新启动实例,它将保持相同的 IP 地址.不幸的是,我们无法将地址重新分配给您的实例,因为该地址会被释放回其他 EC2 实例使用的池中.

Actually, When you stop/start your instance, the IP address will change. If you reboot the instance, it will keep the same IP addresses. Unfortunately, it is not possible for us to reassign the address to your instance as that address would have been released back into the pool used by other EC2 instances.

如果您想在以后避免此问题,请根据您的需要:

If you want to avoid this issue in the future, depending on your needs:

  • 如果您只需要一个固定的公网 IP 地址,您可以为您的实例分配一个弹性 IP 地址.
  • 如果您需要公有和私有 IP 地址在实例的整个生命周期内保持不变,您可以改为在 VPC 中启动您的实例.分配给 VPC 中的实例的私有 IP 地址在实例中一直保留到终止.

要了解更多信息,请参阅 aws 文档 分配弹性ip.

To learn more, see the aws documentation to assign elastic ip.

这篇关于重启后EC2实例的IP地址发生变化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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