Rip-Off
Rip-Off

Reputation: 368

AWS EC2 / Route 53 reverse DNS lookup

I have the following setup in EC2:

A server which has an Elastic IP assigned to it and a DNS name entry in Route 53 pointing to that Elastic IP.

Is it possible to retrieve the DNS name configured in Route 53 from the server that has the Elastic IP assigned? If yes, how can I do that?

Upvotes: 1

Views: 3278

Answers (2)

Allen Luce
Allen Luce

Reputation: 8389

You can do this with awscli and jq if you also know the hosted zone ID:

aws route53 list-resource-record-sets --hosted-zone-id ZA6KYPP25HCIO | jq -j '.ResourceRecordSets[] | select (.Type=="A") | select (.ResourceRecords[].Value == "10.0.0.1") | (.Name|rtrimstr("."))'

where ZA6KYPP25HCIO is the hosted zone ID and 10.0.0.1 the IP of your host.

You can also fill out a form asking Amazon to create a DNS entry in the reverse zone pointing at your host. If you do that, a simple dig -x or nslookup for the PTR record will give you the name.

AWS doesn't currently support automatic mapping of your Elastic IP addresses back to the DNS names you've created for them.

Upvotes: 3

Paul Frederiksen
Paul Frederiksen

Reputation: 384

You can do a reverse lookup with dig.

# dig -x 12.12.12.12

Obviously 12.12.12.12 is the IP you want to look up.

Are you trying to do this with the API instead? It looks like you should be able to do it with some magic. Take a look at http://docs.aws.amazon.com/Route53/latest/APIReference/Welcome.html

Upvotes: 0

Related Questions