AWS Builder Center
Route 53 Alias vs CNAME: Which DNS Record Should You Use?

Route 53 Alias vs CNAME: Which DNS Record Should You Use?

Learn how Route 53 Alias and CNAME records differ, when to use each one, and how to configure DNS correctly for custom domains, CloudFront distributions, and application endpoints.

Introduction

When connecting a custom domain to an AWS application, one of the first decisions is choosing the right DNS record.
You might want  example.com  to point to a CloudFront distribution,  www.example.com  to point to another hostname, or  api.example.com  to route traffic to an application endpoint.
This is where the difference between an Alias record and a CNAME record in Amazon Route 53 matters.
Both can help direct users toward a destination, but they work differently. Choosing the wrong record type can lead to configuration problems, especially when working with a root domain such as  example.com .
Let’s look at how they work and when to use each one.

What is a CNAME record?

A CNAME record maps one DNS name to another DNS name.
For example, suppose your website is available through a CloudFront hostname:
 d123example.cloudfront.net 
You want users to access the website through:
 www.example.com 
You can create a CNAME record like this:
Setting
Value
Record name
 www 
Record type
CNAME
Value
 d123example.cloudfront.net 
TTL
300 seconds
When someone looks up  www.example.com , DNS returns the canonical name. The resolver then looks up that destination to obtain the address needed to connect.
The important thing to remember is that a CNAME points to another hostname, not directly to an IPv4 address.
CNAME records are useful when your destination is a hostname that can change its underlying IP addresses without requiring you to update your own record.
However, a CNAME cannot be created at the root of a hosted zone. For example, you cannot create a CNAME record for  example.com  itself.

What is a Route 53 Alias record?

An Alias record is an Amazon Route 53 feature that lets you direct DNS queries to supported AWS resources or to certain records within the same hosted zone.
Supported destinations include resources such as:
  • Amazon CloudFront distributions
  • Elastic Load Balancing load balancers
  • Supported Amazon S3 website endpoints
  • Certain Amazon API Gateway endpoints
  • Other eligible Route 53 records in the same hosted zone
For example, you can create an Alias record that directs  example.com  to a CloudFront distribution.
The record configuration might look like this:
Setting
Value
Record name
Leave empty for the zone apex
Record type
A
Alias
Enabled
Route traffic to
Your CloudFront distribution
Route 53 handles the destination lookup for supported AWS resources and returns the appropriate DNS answer. You do not need to maintain a list of changing IP addresses for the destination.
Unlike a CNAME, an Alias record can be created at the root of a hosted zone, such as  example.com .
This makes Alias records particularly useful when connecting root domains to AWS services.

Alias vs CNAME: The main differences

Feature
Route 53 Alias
CNAME
Destination
Supported AWS resources and eligible records in the same hosted zone
Any valid target hostname
Root domain support
Yes, for supported configurations
No
Points directly to an IP address
No, it is not a regular IP address record
No
Custom TTL
Not for aliases targeting AWS resources
Yes
Works with non AWS hostnames
Not as a general arbitrary hostname target
Yes
Route 53 DNS query charges
No charge for Alias queries to AWS resources
Standard Route 53 query charges apply
AWS resource address changes
Route 53 handles supported resource changes
The destination hostname is resolved separately
One important detail is that Alias records are not a separate DNS record type in the usual DNS response. For example, an Alias configured as an A record appears as an A record in DNS lookup results.

Example 1: Connecting a root domain to CloudFront

Suppose you host a frontend application behind CloudFront and want it available at both:
  •  example.com 
  •  www.example.com 
For the root domain, create an Alias A record pointing to the CloudFront distribution.
For  www.example.com , you can use either a CNAME pointing to the CloudFront hostname or an Alias A record targeting the distribution.
If IPv6 is enabled for the CloudFront distribution, configure an appropriate AAAA record as well.
Remember that CloudFront must also be configured with the matching alternate domain names, and the required TLS certificate must cover those names. DNS configuration alone does not complete the HTTPS setup.

Example 2: Pointing a subdomain to another hostname

Suppose your application uses an external service with the hostname:
 customer.vendor-example.com 
You want your users to access it through:
 portal.example.com 
If the service provider instructs you to use a CNAME, you can configure:
Setting
Value
Record name
 portal 
Record type
CNAME
Value
 customer.vendor-example.com 
TTL
300 seconds
This is a suitable use case for CNAME because the destination is an arbitrary hostname, rather than a supported AWS resource that you can select as an Alias target.
Always follow the destination service's setup instructions, especially if it requires domain verification or additional records.

Why can't a CNAME be used at the root domain?

The root domain, also called the zone apex, is the domain itself, such as  example.com .
DNS zones require records such as SOA and NS at the apex. A standard CNAME cannot coexist with other record types at the same name, so a CNAME at the zone apex is not permitted.
Route 53 Alias records solve this problem for supported destinations. They allow you to configure an A or AAAA record at the zone apex while directing queries to an eligible AWS resource.
This is one of the main reasons Alias records are commonly used when connecting root domains to CloudFront or load balancers.

What about TTL and DNS caching?

TTL determines how long DNS resolvers can cache a record before querying again.
With a standard CNAME record, you can configure the TTL yourself. For an Alias record pointing to an AWS resource, Route 53 uses the TTL associated with that resource, so you cannot set a custom TTL for that Alias.
This matters when changing DNS destinations during a migration.
Even after you update a record, users may continue to receive cached answers until their resolvers refresh them. Changing the record does not instantly clear caches across the internet.
If you are planning a migration, review the existing TTL values in advance and allow time for cached records to expire.

Common mistakes to avoid

1. Creating a CNAME for the root domain
Use a Route 53 Alias record for a supported destination instead.
2. Assuming every AWS hostname can be selected as an Alias target
Alias records only support eligible AWS resources and certain records in the same hosted zone. For an arbitrary hostname, use a CNAME where appropriate.
3. Assuming DNS configuration automatically enables HTTPS
You still need the correct certificate and application or CloudFront configuration.
4. Expecting DNS changes to take effect immediately
Resolvers may cache previous answers until the relevant TTL expires.
5. Using an Alias record without checking the destination requirements
For example, an S3 website endpoint and an S3 bucket used for private object storage are not interchangeable. Check the requirements of the specific AWS service before creating the record.

Which one should you use?

Use a Route 53 Alias record when pointing a domain to a supported AWS resource, especially when you need to use the root domain.
Use a CNAME record when pointing a subdomain to another hostname, particularly when the destination is managed by an external provider.
For a typical application hosted behind CloudFront, an Alias A record for  example.com  and either a CNAME or Alias A record for  www.example.com  is a common configuration.
The right choice depends on the destination and the DNS name you are configuring, not simply on which record type appears easier to create.

Conclusion

Alias and CNAME records solve similar problems, but they are not interchangeable in every situation.
CNAME is a standard DNS record that maps one hostname to another. Route 53 Alias is an AWS specific feature that supports selected destinations and allows root domain configurations that a standard CNAME cannot provide.
Understanding this difference helps avoid common DNS mistakes when deploying websites, connecting custom domains, or moving applications to AWS.
When configuring your next domain, start by identifying the destination, check whether Route 53 supports it as an Alias target, and then choose the record type that fits your DNS name.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article