A CNAME (Canonical Name) record is a type of DNS (Domain Name System) record that maps an alias hostname to the real or canonical hostname. This allows a subdomain to be pointed to another domain or subdomain, effectively redirecting all requests to the canonical hostname.
It's important to note that a CNAME record can't be used to point to an IP address, only a domain or subdomain. Also, the domain or subdomain specified in the CNAME record must have its DNS record, typically an A or AAAA record, that contains the IP address that the domain or subdomain resolves to.
When using CNAME records, there are a few key things to keep in mind:
CNAME records can't point to an IP address, only a domain or subdomain.
CNAME records can't be used in the root domain.
CNAME records can cause a delay in DNS resolution.
CNAME records can't coexist with other types of records, such as MX, NS or SOA.
By keeping these things in mind, you can ensure that your CNAME records are set up correctly and are working as intended.
Subdomain to parent domain
Subdomain to subdomain
Subdomain to other root domain
A record for xyz.com will be in another zone file, hosted on another Name Server.
AWS Route53 Alias
AWS Route 53 Alias record is a type of DNS record that allows you to map a hostname to a specific Amazon Web Services (AWS) resource, such as an Amazon S3 bucket, an Elastic Load Balancer, or a CloudFront distribution.
An Alias record works similarly to a CNAME record, in that it allows you to point a subdomain to another destination. However, there are some key differences between Alias records and CNAME records:
Alias records can be used to map a hostname to any AWS resource that has a publicly resolvable DNS name, whereas CNAME records can only map to a domain or subdomain.
Alias records can be updated automatically if the IP address of the AWS resource changes, whereas CNAME records would need to be updated manually.
Alias records are free, unlike CNAME records, you don't have to pay for each Alias record.
One of the main use cases for Alias records is to map a hostname to an Amazon S3 bucket that is configured as a static website. By using an Alias record, you can map a hostname to the S3 bucket's endpoint, and ensure that your website is available even if the bucket's IP address changes.
AWS Route53 Alias Example
|AWS Route 53 Alias||CNAME|
|Target resource||Any AWS resource that has a publicly resolvable DNS name||Domain or subdomain|
|Automatic updates||Updated automatically if the IP address of the AWS resource changes||Need to be updated manually|
|Cost||Free||May incur cost|
|Root domain||Can be used on the root domain||Can't be used on the root domain|
|Performance||Resolved quickly||Comparatively slower|
If you have an interest in certifications, kindly visit the courses page.