My domain is example.com
I want to add sub domain like subdomain.example.com
My domain register in godaddy. I created Hosted Zone in aws route 53 and changed dns in godaddy. example.com working as i want.
But, now i want to add sub domain in this domain. Bu i don't do this.
I tried first this (site link):
Login to your AWS console.
Click here to go to AWS route53 console. From the left bar click Hosted zones.
From the top bar click Create Hosted Zone.
>
In the right pane, put subdomain.maindomain.com as the domain name and click Create.Copy the name servers for this domain for further use.
Now go to the records set for your main domain and click Create Record Set.
In the right pane, put subdomain. in the Name section, choose Type as NS
and for Value put the previously copied name servers and then click Create.
But this didn't work.
Then i tried this.
So in that case create a CNAME record where example.com will be canonical name and client.example.com will be alias record.
Once this is done now example.com and client.example.com will both resolve to the same IP address i.e to the Load balancer.
But still didn't work.
How can i do this?
Best Answer
The key trick in setting up a subdomain is linking the subdomain with the parent domain through a set of name servers - NS records. I.e. the
subdomain.example.com
is known to its set of nameservers (NS records) and the parent domainexample.com
must know what these NS are for the subdomain. Just like in GoDaddy where you set theexample.com
's Route53 NS that are then inserted into the.com
zone as a link to your domain. Makes sense?This is how you create a subdomain in Route53:
Create new Hosted Zone
subdomain.example.com
in Route53 and copy the set of **NS records* to a clipboard or Notepad or somewhere:(I'm using my domain aws.nz for this demo - example.com subdomain can't be created in R53)
The open
example.com
hosted zone details (or aws.nz in this case) and click Create Record Set. Set:subdomain.example.com
Create some record in subdomain, e.g.
test.subdomain.example.com
=192.0.2.123, wait a minute and try to resolve it:Hope that helps :)