CNAME and ALIAS Records in AWS

By Łukasz Kallas
Picture of the author
Published on
aws image

AWS Route 53 is the service that handles DNS management. This post will explain the differences between CNAME and ALIAS records.

What is a CNAME Record?

A CNAME (Canonical Name) record maps an alias name to a true or canonical domain name. Essentially, it redirects one domain name to another. For example, you might have a CNAME record that maps www.example.com to example.com.

Key Characteristics of CNAME Records:
  • Redirection - Redirects one domain name to another.
  • Only for Subdomains - Cannot be used at the apex of a domain (e.g., example.com), only for subdomains (e.g., www.example.com).
  • Multiple Levels - You can chain CNAME records, though this is not recommended due to increased DNS resolution times.
What is an ALIAS Record?

An ALIAS record is specific to AWS Route 53. It functions similarly to a CNAME record but can be used for both root and subdomain records. An ALIAS record can map a domain name to an AWS resource, such as an Amazon S3 bucket, CloudFront distribution, or an Elastic Load Balancer.

Key Characteristics of ALIAS Records:
  • Flexibility - Can be used at the apex of a domain (e.g., example.com), unlike CNAME records.
  • Integration with AWS Services - Directly integrates with AWS resources, making it easier to point your domain to AWS infrastructure.
  • No Additional Cost - Queries to ALIAS records pointing to AWS resources are free.
When to Use CNAME vs. ALIAS Records
Use CNAME When:
  • You need to redirect a subdomain to another domain.
  • You are not using AWS Route 53 and need to alias a subdomain to another domain name.
Use ALIAS When:
  • You need to map the root domain (e.g., example.com) to an AWS resource.
  • You are using AWS Route 53 and need to integrate DNS records with AWS services.

Stay Tuned

Want to learn?
The best articles, links and news related to software development delivered once a week to your inbox.