DNS Records are an important topic that needs to be known by everyone who is preparing for AWS certification exams. DNS servers create DNS records to provide crucial information about a domain or a hostname, especially its current IP address. Though there are many types of DNS records, in this article we will see only five types of it.
A RECORD
A record, also known as 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 type of DNS record that points to a domain or subdomain to a static IP address. It becomes easy for people to make a search using domain names by associating the domain name with the IP address. Because the domain name is easy to remember and IP address is very difficult to remember.
CNAME RECORD
A CNAME or Canonical name record is used to map a domain name with another domain name. For example, you can point demo.com and www.demo.com to the same website which is hosted on the same server. That is 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. If you have many subdomains like mail.demo.com, ftp.demo.com, etc., and you wish to point all these subdomains to the main domain, i.e., demo.com, then you can create CNAME record instead of creating separate A records for each subdomain. A CNAME record should never point directly to an IP address. It should always point to another domain. They are useful when you have registered your domain name to many countries and you need to redirect all of them to your main domain.
ALIAS RECORD
It is Amazon Route 53 specific which means it only works with Route 53. It is not supported by third parties. It is similar to CNAME record. The difference is that ALIAS record is a virtual host record type and it can co-exist with other records on the same name. You cannot build an alias record at the top node of DNS, unlike CNAME record. It can also be used to alias a root domain to a different service which cannot be done using CNAME record. ALIAS record can only redirect queries to selected AWS resources like Amazon S3 buckets, Cloud front distributes and other records in the 53 hosted zone.
MX RECORD
MX record or Mail Exchange record is used to set up email servers. They need to be mapped correctly for your mails to be delivered to your address. It is used to indicate which mail servers get incoming mail for your domain. It also indicates where emails that are sent to your domain need to be routed to. If the MX record points to a wrong destination, you will not receive an email.
The MX record contains two parts. They are priority and domain names. For instance, consider 0 mail.demo.com. Here, 0 is the priority. A lower number indicates a higher priority. And mail.demo.com is the mail server it connects to. Outgoing mail servers connect to MX servers based on the level of priority.
If the MX record has more than one record with the same priority, it will pick anyone at random. It needs to be used together with A records. When another mail server wishes to communicate with your mail server, it would look for an MX record.
AAAA RECORD
It is similar to A record, but the difference is that it is for IPv6 addresses. It maps a domain name to the IP address version 6 of the computer which is hosting the domain. One of the advantages of using AAAA record is that IPv6 stores 128 bit IP addresses. But the IPv4 of A record stores 32 bit IP addresses.