Getting Started with AWS
Hosting a Static Website
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

Step 5: Associate a Domain Name with Your Website Using Amazon Route 53

The easiest way for your customers to access your website is through a memorable domain name. If you haven't done so already, register your domain name. In the procedures on this page, replace "example.com" with your domain name.

Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service. It is designed as an extremely reliable and cost-effective way to route visitors to websites by translating domain names (such as www.example.com) into the numeric IP addresses (such as 192.0.2.1) that computers use to connect to each other. With Amazon Route 53, you pay only for the domains you configure and the number of queries that the service answers. For more information, see Amazon Route 53.

To associate a domain name with your website, use Amazon Route 53 to complete the following tasks.

Allocate Name Servers to Route Traffic for Your Domain

The most important function of DNS servers is the translation of memorable domain names and hostnames into the corresponding numeric IP addresses. When you create a hosted zone, Amazon Route 53 assigns four name servers to your hosted zone. These name servers are called the delegation set.

To allocate the name servers

  1. Open the Amazon Route 53 console. If you are new to Amazon Route 53, you see a welcome page; click the Get Started Now button under DNS Management and then click Create Hosted Zone.

  2. In the navigation pane, click Hosted Zones.

  3. Click Create Hosted Zone.

  4. In the Domain Name box, enter your domain name and then click Create.

  5. Select the hosted zone that you just created. In the details pane, Delegation Set lists name servers that were allocated for your domain.

Create Record Sets for Your Domain and Subdomain

Create an alias resource record set that routes queries for your domain name to the Amazon S3 domain name for your bucket.

To configure the alias record set for your root domain

  1. On the Hosted Zones page, select the hosted zone that you created for your domain.

  2. Click Go to Record Sets.

  3. Click Create Record Set.

  4. Under Create Record Set, do the following:

    1. Leave the default name, which is the root domain.

    2. From the Type list, select A — IPv4 address.

    3. In Alias, click Yes. An alias enables Amazon Route 53 to associate your domain name with your website hosted in Amazon S3. Otherwise, the alias record must be associated with an IP address.

    4. Click Alias Target. Select your root domain website endpoint (example.com) from the list. Do not select the www subdomain endpoint (www.example.com).

    5. In the Routing Policy list, select Simple.

    6. Leave Evaluate Target Health set to No.

    7. Click Create.

Next, create an alias resource record set that routes queries for your www subdomain name to the Amazon S3 domain name for your bucket.

To configure the alias record set for your www subdomain

  1. On the Hosted Zones page, select the hosted zone that you created for your domain.

  2. Click Go to Record Sets.

  3. Click Create Record Set.

  4. Under Create Record Set, do the following:

    1. In the Name box, type www. The root domain is already specified for you, and the connecting period (.) is specified when you start typing.

    2. From the Type list, select A — IPv4 address.

    3. In Alias, click Yes.

    4. Click Alias Target. Select your www subdomain website endpoint (www.example.com) from the list. Do not select the root domain endpoint (example.com).

    5. From the Routing Policy list, select Simple.

    6. Leave Evaluate Target Health set to No.

    7. Click Create.

Set Up a DNS Provider

If you registered a new domain name and have used that name while doing this tutorial, you're ready to set up Amazon Route 53 as your DNS provider.

Alternatively, if you're reusing a domain name that was previously associated with another website, you might need to transfer other DNS records from your current DNS provider to Amazon Route 53 in order to ensure the continued availability of the services hosted under the domain name. To determine which DNS records you must replicate in Amazon Route 53, check the DNS record settings configured for the domain in your current DNS provider. Two records that you should not transfer to Amazon Route 53 are the Start of Authority (SOA) and Name Server (NS) records. These records were set by Amazon Route 53 when the name servers were allocated, and they should not be changed.

First, log into the domain name registrar that you used to register your domain name. Use the web interface provided by the registrar to set the name servers for your domain to the name server values you noted under Delegation Sets. How you do this depends on the registrar that you used.

Wait between two to 48 hours for the Internet DNS resolver network to propagate name server changes. To see if the name server change has gone through, use a command line utility such as dig (for Mac OS X, Unix, or Linux) or nslookup (for Windows). The following example shows how use dig to see which name servers are associated with your domain.

dig example.com

When the AUTHORITY SECTION of the output shows the AWS name servers that you allocated using Amazon Route 53, the DNS changes have propagated through the DNS resolver network.

;; AUTHORITY SECTION:
example.com.	118928	IN	NS	ns-806.awsdns-36.net.
example.com.	118928	IN	NS	ns-1456.awsdns-54.org.
example.com.	118928	IN	NS	ns-1713.awsdns-22.co.uk.
example.com.	118928	IN	NS	ns-105.awsdns-13.com.

After your DNS changes have propagated, you'll be able to view your website using your custom domain name.

If you open your www subdomain (www.example.com) in your web browser, it redirects to your domain (example.com).