Skip to content

Route 53 CNAME and ALIAS differences

0

IHAC using hostname as origin in their CDN configuration, this hostname will map to a Route53 latency record which in turn is an ALIAS to weighted record for multiple ALBs within the region. They are using CNAME to map the origin hostname to the latency based record. I need to understand the trade-offs between CNAME and ALIAS in Route 53. Any help is welcome.

asked 2 years ago2K views

2 Answers
1
Accepted Answer

The trades off is that ALIAS offer the advantage of using ALIAS on the apex domain, which you can’t use CNAME for apex due to RFC definition. Additionally, ALIAS records will react to any changes in ALB IP address immediately whereas CNAMEs can return an inactive IP until the TTL expires. This means that if ALB IPs change for some reason, you immediately get the new ALB IP, where CNAME you would have to wait the CNAME TTL expire, which can cause downtime for your application.

The last, ALIAS record are not chargeable where customer pay for CNAME resolution.

I hope it helps.

answered 2 years ago

EXPERT

reviewed 2 years ago

EXPERT

reviewed 2 years ago

1

There are several important differences between CNAME and ALIAS records in Amazon Route 53 that are relevant to your scenario:

  1. Zone apex support: ALIAS records can be used at the zone apex (naked domain), while CNAME records cannot. This is not directly applicable to your case since you're using a hostname.

  2. AWS resource integration: ALIAS records are designed to route traffic to specific AWS resources, including Elastic Load Balancers (ALBs in your case), CloudFront distributions, and S3 buckets. They automatically recognize changes in the IP addresses of these resources.

  3. Performance: ALIAS records typically have better performance because Route 53 can respond directly with the IP address of the target resource, whereas CNAME records require an additional DNS lookup.

  4. Cost: ALIAS records to AWS resources are free, while CNAME records incur a small charge for Route 53 queries.

  5. TTL handling: With ALIAS records, you can't set a custom TTL. Route 53 uses the default TTL for the AWS resource. For CNAME records, you can set a custom TTL.

  6. DNS query behavior: ALIAS records only respond when the name and type match the query, while CNAME records redirect queries regardless of the record type.

In your specific setup, using a CNAME to map the origin hostname to the latency-based record will work, but an ALIAS record might be more beneficial. Here's why:

  1. Better performance: The ALIAS record would allow Route 53 to resolve directly to the IP of the selected ALB, potentially reducing lookup time.

  2. Cost savings: Since you're routing to AWS resources (ALBs), using ALIAS records would be free of charge for Route 53 queries.

  3. Automatic updates: If the IP addresses of your ALBs change, the ALIAS record will automatically update, ensuring continued routing without manual intervention.

  4. Seamless integration: ALIAS records are designed to work well with other Route 53 routing policies, including the latency and weighted policies you're using.

While your current setup with CNAME will function, switching to an ALIAS record for mapping the origin hostname to the latency-based record could provide these additional benefits without changing the overall structure of your routing configuration.

Sources
Choosing between alias and non-alias records - Amazon Route 53
Latency-based routing - Amazon Route 53

answered 2 years ago

EXPERT

reviewed 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.