可以将Elastic IP与实例相关联而不会立即丢失公共IP? [英] Possible to associate Elastic IP to an instance without immediately losing public ip?

查看:114
本文介绍了可以将Elastic IP与实例相关联而不会立即丢失公共IP?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个运行生产网站的Windows EC2实例,并且将DNS配置为使我的域名指向其公共IP。当前没有与实例关联的弹性IP(EIP)。我想开始使用弹性IP,并用我的域名代替公共IP(如果我必须更改实例,可以更改)。

I have a windows EC2 instance running a production website and DNS is configured to have my domain name point to its public IP. There is currently no Elastic IP (EIP) associated with the instance. I would like to start using a Elastic IP and have my domain name point to it instead of the public IP (which can change if I ever have to change the instance).

阅读文档后,我发现此语句令人烦恼:

Reading the documentation I find this statement troubling:


将EIP与实例相关联时,该实例的当前
公共IP地址发布到EC2-Classic公共IP地址
池中。

When you associate an EIP with an instance, the instance's current public IP address is released to the EC2-Classic public IP address pool.

我的担心是:


  • 我为实例分配了一个EIP,并释放了公共IP。

  • 现在我的网站不再可用,因为域名指向不再与我的EC2实例关联的公共IP。

  • 然后,我必须将DNS记录指向EIP。但这最多可能需要48小时才能传播(即,我的网站可能长达48小时都无法访问)。

如何做到这一点而不必经历DNS传播?

How can I do this without having to live through DNS propagation?

推荐答案

如果您的EC2实例位于VPC中,则可以在您的EC2实例上添加第二个网络接口。您可以将您的弹性IP地址与该第二个网络接口相关联。这样,您的EC2实例就可以响应两个IP地址。

If your EC2 instance is in a VPC, you can add a second network interface onto your EC2 instance. You can associate your Elastic IP address with that second network interface. This way, your EC2 instance could respond to both IP addresses.

说明


  1. 在与您的EC2实例相同的子网中创建一个新的网络接口。

  2. 为您的VPC分配一个新的Elastic IP(如果尚未这样做) )。

  3. 将弹性IP地址与新的网络接口(eni)相关联。

  4. 将新的网络接口附加到EC2实例。
  5. li>
  1. Create a new Network Interface in the same subnet as your EC2 instance.
  2. Allocate a new Elastic IP for your VPC (if you haven't done so already).
  3. Associate the Elastic IP address with your new Network Interface (eni).
  4. Attach your new Network Interface to your EC2 instance.

请勿更改您的DNS。

您可能需要RDP / SSH进入EC2实例以进行一些配置更改,以确保您的EC2实例正确响应新IP地址。

You may need to RDP/SSH into your EC2 instance to make some configuration changes to ensure your EC2 instance responds correctly to the new IP address.

修改本地计算机上的主机文件以测试连接到您的主机通过新IP地址访问网站。

Modify the hosts file on your local computer to test connecting to your website via the new IP address.

在这种情况下,请进行DNS切换并还原主机文件。

When that works, do the DNS switch and restore your hosts file.

这篇关于可以将Elastic IP与实例相关联而不会立即丢失公共IP?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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