If you have had a domain name parked for a while and want to put it to a 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 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 “berronsolutions.co.uk” 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 “www.berronsolutions.co.uk” to the bucket with the website, it is necessary to:
- create a new bucket called “www.berronsolutions.co.uk” configured to redirect requests to the bucket “berronsolutions.co.uk”
- create an A record of type alias named “www.berronsolutions.co.uk” and pointing to the domain “berronsolutions.co.uk”
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 berronsolutions.co.uk.
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 berronsolutions.co.uk
Trying "berronsolutions.co.uk" ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 58122 ;; flags: qr rd ra; QUERY: 1, ANSWER: 7, AUTHORITY: 0, ADDITIONAL: 0 ;; QUESTION SECTION: ;berronsolutions.co.uk. IN ANY ;; ANSWER SECTION: berronsolutions.co.uk. 4 IN A 126.96.36.199 berronsolutions.co.uk. 21599 IN NS ns-1063.awsdns-04.org. berronsolutions.co.uk. 21599 IN NS ns-1605.awsdns-08.co.uk. berronsolutions.co.uk. 21599 IN NS ns-219.awsdns-27.com. berronsolutions.co.uk. 21599 IN NS ns-878.awsdns-45.net. berronsolutions.co.uk. 899 IN SOA ns-219.awsdns-27.com. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400 berronsolutions.co.uk. 599 IN MX 0 berronsolutions-co-uk.mail.protection.outlook.com.
You can see the 4 NS records corresponding to the 4 name servers, with “ns-219.awsdns-27.com” 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.