我如何知道 Amazon AWS 实例的内部 DNS 名称?
我有一个系统,在 Amazon AWS 云上有 N 个服务器。他们都在同一个区域。实例 A 想要与实例 B 通信,但它显然不通过互联网。据我了解,每次重新启动实例时,内部IP都会发生变化。我的所有实例是否都有一个内部、恒定的 DNS 名称,通过该名称它们可以在彼此之间进行交互,而不必担心重新启动?
I have a system that has N servers on the Amazon AWS cloud. They are all in the same zone. Instance A wants to talk to instance B, but it obviously doesn't go through the internet. As far as I understand, the internal IP changes every time I reboot the instance. Is there an internal, constant DNS name to all my instances, through which they can interact between themselves without worrying about restarts?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
http://alestic.com/2009/06/ec2-elastic-ip-internal
http://alestic.com/2009/06/ec2-elastic-ip-internal
不,无法通过开箱即用的 AWS 实例来使用“固定”IP 地址或 DNS 名称。即使您为实例分配 EIP(弹性 IP),这也只会影响面向公众的 IP/DNS 引用,而不会影响内部 IP/DNS 引用。
我们在 EC2 资产中使用一对 DNS 服务器(它是 Windows,因此它们是主/辅助 AD 域控制器)。通过让所有其他实例使用这对作为其 DNS 服务器,我们可以在每个实例启动时为其分配唯一的计算机名称,并通过这些名称引用任何/所有其他实例。
例如,我们基于 EC2 的 Subversion 服务器有一个 EIP,这意味着当我们从 EC2 外部与它通信时,它始终位于同一位置,但基于 EC2 的 CruiseControl 服务器将其称为 [ourec2domain].SVNHOST,因为它注册了该名称启动时与 DC 一起使用。
No, there is no way to make use of 'fixed' IP addresses or DNS names using the out-of-the-box AWS instances. Even if you assign an EIP (Elastic IP) to the instance, this only affects the public-facing IP/DNS reference, not the internal one.
We use a pair of DNS servers in our EC2 estate (it's Windows, so they're Primary/Secondary AD Domain Controllers). By having all other instances use this pair as their DNS servers, we can assign unique machine names to each instance as they spin-up, and reference any/all other instances by these names.
So for example our EC2-based Subversion server has an EIP which means it's always at the same place when we talk to it from outside EC2, but the EC2-based CruiseControl server refers to it as [ourec2domain].SVNHOST because it registers that name with the DCs at startup.
当我第一次开始使用云时,我也遇到了同样的问题。我也使用 2 个 DNS 服务器的设置,并使用命令
ec2-create-tags添加标签到两个服务器。 --tag Purpose=DNS
使用 http://cloudinitnet.codeplex.com 服务我创建了服务器在启动时运行 powershell 脚本。此 powershell 脚本检查亚马逊的两个 dns 服务器并将它们添加到网络接口。假设此时您有一个 dns 服务器列表,您可以使用下面的代码将条目添加到 dns 服务器。要获取服务器列表,只需使用 Powershell 使用 AWSSDKnet 查询您的帐户即可。
如果您的服务器不是 Windows,那么您可以使用 Ubuntu 或 Amazon Linux“Cloud-Init”来执行相同的任务。
I had the same issues when I first started using the cloud. I too use a setup of 2 DNS servers and add a tag to the two servers using the command
ec2-create-tags <instance> --tag Purpose=DNS
Using the http://cloudinitnet.codeplex.com service I created the server runs a powershell script on startup. This powershell script checks amazon for the two dns servers and add them to the network interface. Assuming you have a list of dns servers at this point you can use the code below to add the entries to the dns server. To get a list of servers just query your account with the AWSSDKnet with powershell.
If your servers are not windows then you can use Ubuntu or Amazon Linux "Cloud-Init" to perform the same task.
从实例来看:
From the instance: