Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
351 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.

question from:https://stackoverflow.com/questions/65834413/aws-ec2-instance-custom-dns-name

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

1 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...