Software Development

How to setup your app on a subdomain using Route 53 from AWS

September 14, 2015
#development

One of our clients told me they want to set up their marketing pages on their main domain name - brandname.com and www.brandname.com, and have their web application (that we built for them) on a different subdomain - app.brandname.com.

Here is how to do it with Amazon Web Services (AWS) and their Route 53 service.

Amazon Route 53 is an authoritative Domain Name System (DNS) service. DNS is the system that translates human-readable domain names (example.com) into IP addresses (192.0.2.0).

In short, you need to create record sets to tell the Domain Name System (DNS) how you want traffic to be routed.

To begin, click on ‘Get Started Now’ in ‘Route 53’ from the AWS Console.

[1-getstarted]

First you create a Hosted Zone with your domain. A hosted zone is a collection of records for a domain. You will need to have a public hosted zone as your site needs to be accessed by anyone on the web wanting to visit your website through your domain name.

[2-createhostedzone]

Note that Route 53 will create for you a name server (NS) record and a start of authority (SOA) record for your hosted zone. Don’t change anything here, as this is what defines the name servers you’ll need to hook up your domain name.

[3- NS-SOA]

We will need to create 3 records: brandname.com, www.brandname.com for the marketing site and app.brandname.com, which points to our web app.

For brandname.com, you will need to be set up with an “Address” (A) record. You should leave the Name as blank because this is the naked/root domain of your site. Set the Type as (A - IPv4 address) and the TTL (time to live) to 300s or less (this means if this DNS record was changed on the authoritative nameserver, DNS servers around the world would still show the old value from their cache for up to 300s after the change).
Finally, set the Value to the IP address of your marketing website. Lastly, leave Routing Policy to simple.

[4-createRS]

For www.brandname.com, you will need to be set up with a CNAME record. You should set the Name as “www". Set the Type as "CNAME - Canonical name" and the TTL (time to live) to “300".
Set the Value to the Public DNS value of your marketing website and leave Routing Policy to simple.

[5a-publicDNS]
[5b-cnameRS]

Similarly for app.brandname.com will need to be set up with a CNAME record. You should do the same things you did as for www.brandname.com, except of course to set the Value to the Public DNS value of your web app instead of the marketing website

[6-subdomainRS]

Last but not least, you need to configure your domain to use the nameservers given to you on Route 53.

7-nameservers

Curious about how to set up nameservers on GoDaddy?

Related: I bought a domain for a website, now what

There you have it. A quick how-to guide to setting up your app on a subdomain using Route 53 from AWS.

You May Also Like