Route53 domain and subdomain and fourth level wildcard

amazon-route53domain-name-system

I'm trying to configure a domain name setup like below and having trouble with Route53.

base.com
sub.base.com
*.sub.base.com => CNAME sub.base.com

I've attempt to create a new hosted zone sub.base.com and add the NS records to base.com. This does appear to delegate (though I'm not sure it is necessary on AWS). I then add the wildcard CNAME to the sub.base.com Zone, and also add an A record to the zone. Now when I lookup a name (dig demo.sub.base.com) dig just gives me back the SOA record and doesn't resolve to the A record.

How should I be configuring this domain layout?

Best Answer

I've attempt to create a new hosted zone sub.base.com and add the NS records to base.com. This does appear to delegate (though I'm not sure it is necessary on AWS).

This is necessary anytime you delegate, it's not specific to AWS.

I then add the wildcard CNAME to the sub.base.com Zone, and also add an A record to the zone. Now when I lookup a name (dig demo.sub.base.com) dig just gives me back the SOA record and doesn't resolve to the A record.

The reason you are getting an SOA back is that demo.sub.base.com does not exists in sub.base.com zone. This is best visualized using dig +trace demo.sub.base.com via command prompt or http://digwebinterface.com/.

How should I be configuring this domain layout?

Remove the CNAME from the base.com zone and configure your demo.sub.base.com record in the sub.base.com zone. Then create *.sub.base.com in the sub.base.com zone as a CNAME to demo.sub.base.com.