Posted in Information Technology

How to Use Your Own Domain to Access an AWS-Hosted Website

If you have had a domain name parked for a while and want to put it to better use, this post explains my experience in doing so.

Since my idea was to create a very simple website with static content, I decided to use an AWS S3 bucket. AWS documentation is good so I will not repeat the steps described there.

Creating a Zone Through Route 53

The purpose of this post is to clarify how to use your own domain name to serve the website content by using Amazon Route 53. From the AWS website:

Amazon Route 53 is a highly available and scalable Domain Name System (DNS) web service.

The first step with Route 53 is to create a zone. A zone represents a collective configuration for a group of DNS servers. The DNS configuration for a zone is stored in a zone file. The zone name must be the same as the corresponding domain name that, in turn, must also be the same as the name of the S3 bucket containing the website files.

In order to create the zone, there are two options: one is to import the zone file of the current DNS service provider and the other is to create the resource records manually.

However you do it, it is very important to export the zone file of the current DNS provider as it may be an invaluable reference. In my case, I had an email address associated to my domain and, after migrating to Route 53, I stopped getting emails. It was only after checking the exported zone file that I noticed that the MX record was missing in the Route 53 zone.

Zone File Records

When creating the zone, Route 53 will automatically generate the SOA and NS records. SOA (Start of Authority) record designates the authoritative name server for the zone or, in other words, the primary master name server. NS (Name Server) designates a name server for the zone. In this case, Route 53 generates 4 NS records corresponding to 4 different name servers (including the authoritative name server).

In addition, it is necessary to create an A record to map the domain name to the S3 bucket containing the website. Normally, an A record maps a domain names to an IPv4 address. However, Route 53 provides an extension to the standard DNS configuration that allows the creation of A records of type alias. When creating such a record, Route 53 gives you a list of the available AWS resources that can be mapped. For instance, my A record named “” can be mapped to the S3 bucket with the same name.

It is also worth noticing that CNAME records cannot be used in the usual way. For instance, in order to point the subdomain “” to the bucket with the website, it is necessary to:

  1. create a new bucket called “” configured to redirect requests to the bucket “”
  2. create an A record of type alias named “” and pointing to the domain “”

Name Servers Configuration

The final step in this process is to change the configuration of the current DNS provider to select as name servers the ones corresponding to the zone created in Route 53. After that, it took a few minutes for the new website to be available on the URL

My domain name was registered with GoDaddy and it was an easy task to export the zone file and change the name servers configuration through their website.

Finally, with the command “host”, it is possible to query the DNS information associated to a domain:

host -a
Trying "" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58122 ;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ; INANY ;; ANSWER SECTION: 1 7200 900 1209600 86400

You can see the four NS records corresponding to the four name servers, with “” being the master. There is also an A record to map the domain name to the S3 bucket IP.

By the way, if we had not wanted to go through the trouble of configuring our own domain name (or maybe we had not had one available), we could have used the endpoint provided by AWS.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s