简体   繁体   English

AWS EC2 实例自定义 DNS 名称

[英]AWS EC2 instance custom DNS name

When I create a new EC2 instance, and I give it a public IPv4 address, it assigns a "Public IPv4 DNS" that looks something like "ec2-55-55-55-55.region.amazonaws.com".当我创建一个新的 EC2 实例并为其提供一个公共 IPv4 地址时,它会分配一个类似于“ec2-55-55-55-55.region.amazonaws.com”的“公共 IPv4 DNS”。

Is there a way to customize the automatically assigned addresses?有没有办法自定义自动分配的地址?

For example, when new EC2 instances are launched, I want it to assign something like "ec2-55-55-55-55.region.aws.example.com".例如,当启动新的 EC2 实例时,我希望它分配类似“ec2-55-55-55-55.region.aws.example.com”的内容。

I was thinking this would be useful for things such as .ssh/config where I can match based on the hostname我在想这对于我可以根据主机名匹配的.ssh/config之类的东西很有用

Hostname *.aws.example.com
  SSH_OPTIONS

I am sure I can make this work by writing a bunch of logic triggered by EC2 actions, but was hoping there was something more or less provided by AWS (Route 53 integration?) that would let you do it.我确信我可以通过编写一堆由 EC2 操作触发的逻辑来完成这项工作,但希望 AWS 或多或少提供了一些东西(Route 53 集成?)可以让你做到这一点。

Thanks.谢谢。

As of January 2021, there is no possibility to automatically register the public IP address of the Elastic Network Interface (ENI) of a created EC2 instance under a particular DNS name (or some form of proposed "pattern") in Route 53 as an A/AAAA record.截至 2021 年 1 月,不可能在 Route 53 中以特定 DNS 名称(或某种形式的提议“模式”)自动将已创建 EC2 实例的弹性网络接口 (ENI) 的公共 IP 地址注册为 A /AAAA 记录。

Just like you said, you gonna have to trigger AWS API calls to do that by any means provided (CloudWatch Events, EventBridge Events or as part of any Infrastructure-as-Code deployment of your EC2 instances using CloudFormation, CDK, Terraform, etc).就像您说的那样,您将不得不触发 AWS API 调用以通过提供的任何方式(CloudWatch 事件、EventBridge 事件或作为使用 CloudFormation、CDK、Terraform 等的 EC2 实例的任何基础设施即代码部署的一部分)执行此操作.

Of course, if your domain is not administered under a Route 53 Public Hosted Zone, you have to take appropriate actions on behalf of your domain registrar in order to register the public IP address under any A/AAAA record.当然,如果您的域未在 Route 53 公共托管区域下进行管理,您必须代表您的域注册商采取适当的措施,以便在任何 A/AAAA 记录下注册公共 IP 地址。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM