AWS Route53 Tutorial: Creating a Subdomain
Quick introduction
In many cases, you might be required to create different
environments for your web application; for example, you might need
a development environment along with your production
environment.
Let's say you host your web application at
example.com
, and now your team needs a
dev.example.com
to deploy and test the changes.
What's the easiest and quickest way to accomplish that?
Well, this is what this tutorial covers!
Steps
It's quite easy to do this, but when I did it the first time, I got really confused because of the number of available resources online. Some of them went too deep and provided more information than needed. All we need to do is create a hosted zone for that specific sub-domain and reference it in our root domain's hosted zone—that's it!
- Go to AWS Console and sign in.
- Navigate to Route53 service.
-
Create a new hosted zone for your subdomain; the name must match
your root domain. If your domain is
example.com
, your subdomain must end withexample.com
, for example,dev.example.com
. -
Once the new hosted zone is created, copy the
NS
record values. There should be four name servers. -
Navigate to your root domain's hosted zone
(
example.com
) and create a new record. -
In the record name, write
dev
and then selectNS
record as the record type.
You must enter the subdomain before opening the drop-down list; otherwise, the NS record type will be grayed out. - Paste the four name servers you copied in step#4 into the value text area.
- Click on Create Records and wait for some time for the DNS propagation.
Conclusion
This tutorial provides a straightforward approach to achieving this task using AWS Route53. You can efficiently establish the necessary DNS configuration by creating a hosted zone for the specific subdomain and referencing it in the root domain's hosted zone.