Dynamic DNS for subdomain using AWS & Route53

amazon-route53amazon-web-servicesdomain-name-system

I'm writing a dynamic DNS service which should return results based on a db query.

My DNS server is written in node.js and it queries the database for the actual IP.

My domain is hosted on Route53, but I'm not sure how to point all sub-subdomains to my server.

so basically, I have example.com registered under route53, and I would like to point all *.dyn.example.com to my DNS server (ec2 instance) so it will resolve it to the right IP.

I've tried to create a new name server entry, but route53 does not allow wildcard for it. I also have a lot of other subdomains there, which is why I want to only point *.dyn.example.com to my DNS server rather than *.example.com.

Any help is appreciated…

Best Answer

You need to configure an NS record for dyn.example.com on Route53 which points to the EC2 instance running your custom name server which would be authoritative for the domain dyn.example.com. Now DNS queries for hostnames under dyn.example.com would hit your EC2 instance. All other resource records would be on this EC2 name server so that it can respond to queries.

Something like this should work.

dyn.example.com.        172800  IN  NS  ec2.example.com.

You do not need a wild card entry for the NS record. You may need to add glue records if the hostname you have given to the EC2 instance is under dyn.example.com

You probably can just use the Route53 API to create/modify/delete DNS records based on your application logic and use Route53 itself to host the zone, in which case you do not need to run a separate name server.