每次停止/启动实例时,EC2 实例是否会更改实例的 IP 地址?有没有办法保持IP地址不变?
Yes, 有一种方法:弹性IP寻址 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html.
AWS instances are launched with a dynamic IP address by default, which means that the IP address changes every time the server is stopped and restarted. In many cases, this is not desired and so, users also have the option to assign the server a static IP address (also known as an “elastic IP”).3 https://dzone.com/articles/assign-fixed-ip-aws-ec2
According to Amazon 1 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html, 2 https://aws.amazon.com/ec2/pricing/on-demand/#Elastic_IP_Addresses:
弹性IP地址是专为动态云计算而设计的静态IPv4地址。弹性 IP 地址与您的 AWS 账户关联。借助弹性 IP 地址,您可以通过快速将地址重新映射到账户中的另一个实例来掩盖实例或软件的故障。
And:
您可以免费拥有一个与正在运行的实例关联的弹性 IP (EIP) 地址。如果您将额外的 EIP 与该实例关联,您将按每小时与该实例关联的每个额外 EIP 付费。额外的 EIP 仅在 Amazon VPC 中可用。
配置静态 IP 地址:
- 登录 AWS EC2 仪表板。如果需要,请使用区域选择器
单击右上角的 切换到您的实例启动的区域。
- 在仪表板中选择实例。
- 在左侧导航栏中,选择“网络与安全 -> 弹性 IP”菜单项。
- 单击“分配新地址”按钮。
有关设置的更多详细信息,请参阅分配弹性IP地址 https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html#using-instance-addressing-eips-allocating and 配置静态IP地址 https://docs.bitnami.com/aws/faq/configuration/configure-static-address/.
有a small如果弹性 IP 地址未与正在运行的实例关联,或者与已停止的实例或未连接的网络接口关联,则按小时收费。费用按比例分配,具体取决于地区;详细信息可以在亚马逊 EC2 定价 https://aws.amazon.com/ec2/pricing/on-demand/#Elastic_IP_Addresses.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)