Mosheen walks you through
creating an subdomain
for your website

mosheen

I want to create a subdomain for my domain hosted through Amazon Route 53. How do I do that?

If you have an existing domain and hosted zone, and you want to create subdomain records, you can do either of the following:

  • Create the records you need inside the existing "example.com" hosted zone.
  • Create a new hosted zone to hold the records associated with your subdomain, as well as a delegation set in the parent hosted zone that refers clients to the subdomain hosted zone.

The first method requires fewer zones and fewer queries, while the second method offers more flexibility when managing the hosted zones (for example, restricting who may edit the different zones). The second method also can only be used for public hosted zones.

Note: Both methods require that you've already created a hosted zone for your domain. "example.com" is used as an example domain in the following instructions; replace "example.com" with your domain.

To add subdomains to your current hosted zone

  1. Sign in to the Route 53 console, and select Hosted Zones from the navigation pane on the left.
  2. Select the hosted zone for your domain.
  3. Choose Create Record Set and enter the following values:
    For Name, type your preferred subdomain name. For example, if the subdomain you’re attempting to create is "subdomain.example.com", type "subdomain".
    For Type, choose A - IPv4 address.
    For Value, add the IPv4 address of the target EC2 instance.
    Leave all other values as their defaults.
  4. Choose Create to add the record to the hosted zone.

To create a new hosted zone for your subdomain

  1. Sign in to the Route 53 console, and select Hosted Zones from the navigation pane on the left.
  2. Choose Create Hosted Zone.
  3. Enter the following information into the corresponding fields:
    For Domain Name, type your domain name; for example, “subdomain.example.com”.
    For Comment, type something descriptive about the zone.
    For Type, choose Public.
  4. Choose Create. Find the NS type record in the newly created zone, and take note of the four assigned hostnames.
  5. Select Create Record Set and enter the following values:
    For Name, type in a preferred name, or leave it blank to create a record for the subdomain.
    For Type, choose A - IPv4 address.
    For Value, add the IPv4 address of the target EC2 instance.
    Leave all other values as their defaults.
  6. Choose Create.
  7. Select Hosted Zones from the navigation pane on the left, and select the "example.com" parent hosted zone.
  8. Choose Create Record Set, and enter the following information:
    For Name, type your preferred subdomain name. For example, if the subdomain you’re attempting to create is "subdomain.example.com", type "subdomain".
    For Type, choose NS – Name Server.
    For TTL, select the 1d preset button.
    For Value, type the four name server hostnames previously noted on separate lines.
    Leave all other values as their defaults.
  9. Choose Create to commit the record to the hosted zone.

From a terminal window, test the new delegated zone by querying for the record created in Step 6, replacing subdomain and example.com with your subdomain and domain).

For Windows, use this command:

nslookup subdomain.example.com

For Mac or Linux, use one of these commands:

dig subdomain.example.com
dig +trace subdomain.example.com

Did this page help you? Yes | No

Back to the AWS Support Knowledge Center

Need help? Visit the AWS Support Center

Published: 2016-10-31

Updated: 2017-06-09