Demystifying DNS Records
Demystifying DNS Records – A, CNAME, ALIAS, MX and AAAA
DNS Record is a basic and important topic that needs to be covered for anyone preparing for the AWS Certification Exams. DNS servers create DNS records in order to provide crucial information about a domain or a hostname, specifically its current IP address. There are lots of DNS record types but in this article, we will be focusing on 5 types.
5 Types of DNS Record
A Record or Address Record is used to map a root or naked domain name such as google.com to Elastic IP which is associated with the AWS account. It is a DNS record which points a domain or sub domain to a static IP address. The value of an A Record is an IPv4 address shown in dotted decimal notation such as 18.104.22.168. By associating a domain name with an IP address, it makes it easier for people to make a search using a domain name which is easy to remember rather than an IP address which is hard to remember.
A CNAME (Canonical Name) record is used to map a domain name to another domain name. For instance, you can point demo.com and www.demo.com to the same website which is hosted at the same server. In a common scenario, an address record like demo.com (which is a root or naked domain) points to the server IP address, and the CNAME record for www.demo.com points to demo.com.
In other words, demo.com points to the server IP address by using the address record and www.demo.com points to the same address through demo.com using the CNAME record. Moreover, if you have many subdomains like www.demo.com, mail.demo.com, ftp.demp.com, etc. and you want all these subdomains to point to your main domain which is demo.com, then you can create CNAME records rather than creating A records for each subdomain.
In case the IP address of the is changed, it can simply be updated in one place and that is by editing the address record for test.com. That way, www.test.com also inherits the new change automatically.
Note that a CNAME record must never directly point to an IP address. Rather, it should always point to another domain. Moreover, you cannot create a CNAME record for the main domain name itself. Instead, it needs to be an A record. It also cannot coexist with any other data. For instance, if blog.simple.com is a CNAME for demo.com, no other records can be attached to blog.simple.com.
CNAME records are useful when you have registered your domain name to several countries, and you need to redirect all of them to your main domain. For instance, demo.nz and demo.in can be redirected to demo.com. You can also redirect different domain names like demoshop.com and demokindgdom.com to a main domain called demo.com for instance, by creating CNAME records for all the other domains.
Alias record is Amazon Route 53 specific. This means that it only works with Route 53 and is not supported by third parties. ALIAS record is similar to CNAME record in which one domain name points to another domain name. The difference is that ALIAS record is a virtual host record type and it can coexist with other records on that name.
It can also be used if you want to alias a root domain to a different service which cannot be done with a CNAME record. Unlike a CNAME record, you cannot build an alias record at the top node of a DNS which is also known as a zone apex.
An alias record can only redirect queries to chosen AWS resources like Amazon S3 buckets, Cloud Front distributes and other record in the 53 hosted zone in which you care creating the alias. For instance, you can create ab alias record called acme.demo.com that redirects queries to an S3 bucket Amazon which also has the same name, acme.demo.com.
MX record or Mail Exchange records is used to set up email servers. MX records need to be mapped correctly in order for your email to be delivered to your address. An MX record is used to indicate which mail servers get incoming mail for your domain and where the emails that are sent to your domain need to be routed to. In case the MX records point to an incorrect location, you will not receive email.
The MX record contains two parts – the priority and then the domain name., for instance, 0 mail.demo.com. ‘0’ indicates the priority where a lower number means that the priority is higher. ‘mail.demo.com’ is the mail server to which it connects. It differs based on which company is hosting your email. Outgoing email servers connect to MX servers based on the level of priority.
In case an MX record has more than one record with the same priority, it selects any one at random. MX records need to be used in conjunction with A records. The A record would point to the email servers. When another mail server wishes to communicate with your email server, it would look for an MX record. This MX record should point to the A record which is pointing to the mail server’s IP address.
An AAAA record resembles an A record but instead of IPv4 addresses, it is for IPv6 addresses. Elastic IPv6 addresses cannot be supported here. An AAAA record is a DNS record that maps a domain name to IP address Version 6 of the computer which is hosting the domain.
One of the benefits of using AAAA records is that IPv6 stores 128 bit IP addresses in comparison with IPv4 which stores 32 bit IP addresses in A records. As the internet is expanding and new and large amounts of IP addresses need to be created, the capacity of an IPv4 is coming to an end and would soon have to be replaced by IPv6.