How to configure multiple subdomains in 1 Hosted Zone?

0

I have a registered domain xxx.com.

I would like to make an aaa.xxx.com and bbb.xxx.com subdomains, and point them to different locations (in my case, CloudFront distributions). I found conflicting documentation even on the AWS Docs about this use case, and there's a lot of confusion out there on the net in different tutorials.

For the time being, I have the following configuration in Route 53 for the public hosted zone xxx.com:

xxx.com             NS              ...
xxx.com             SOA           ...
<rnd>.xxx.com  CNAME     ... (needed for the ssl cert)
aaa.xxx.com       A               Routes to CloudFront1
bbb.xxx.com      A                Routes to CloudFront2

If I copy&paste the CloudFront2 location here to the browser, I get to the proper static website I'd like to use. If I go to the address bbb.xxx.com, then I see the contents of aaa.xxx.com*. I have waited 72h+ to wait for the DNS caches to clean up, but still no change unfortunately. I'm suspecting I might be doing something completely flawed here :-)

So, my question is: how should such a normal config would look like where there is a root domain + 2 subdomains pointing to different location? Any articles, links would be more than welcome!

2 Answers
0

What you need is NS records in the parent domain for your subdomains.

For example:

  • Record Name = aaa.xxx.com
  • Record Type = NS
  • Value = the four nameservers from the aaa.xxx.com Hosted Zone definition.
EXPERT
answered a year ago
0

Actually, it seems separate Hosted Zone definitions are not required.

I wrote a short tutorial how I managed to solve this for my case: https://xcafebabe.blogspot.com/2023/03/how-do-i-create-multiple-subdomains-for.html

If someone would like to follow the official approach (i.e., separate hosted zones for the subdomains, then NS records in the root domain for the subdomains), here are the relevant docs I was able to find with some help:

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-routing-traffic-for-subdomains.html

https://aws.amazon.com/premiumsupport/knowledge-center/create-subdomain-route-53/

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions