Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.4k views
in Technique[技术] by (71.8m points)

amazon web services - 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".

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".

I was thinking this would be useful for things such as .ssh/config where I can match based on the hostname

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.

Thanks.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

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).

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...