zrbecker
zrbecker

Reputation: 1582

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.

Upvotes: 3

Views: 1826

Answers (1)

httpdigest
httpdigest

Reputation: 5797

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.

Upvotes: 3

Related Questions