Skip to Content

CNAME vs alias

How a CNAME and a Route 53 alias record differ, why alias works at the zone apex, and which AWS resources an alias can point to.

The problem

AWS resources such as load balancers and CloudFront distributions come with an AWS hostname, like lb1-1234.us-east-2.elb.amazonaws.com. Users should see a custom name instead, like myapp.mydomain.com, or just mydomain.com. There are two ways to point the custom name at the AWS one.

CNAME versus alias: a CNAME points a name such as app.mydomain.com to any other hostname, but not at the zone apex, its queries are charged and its TTL is set by the record owner; an alias points a name, even the apex mydomain.com, to an AWS resource, with free queries to AWS targets and automatic tracking of IP address changes CNAME versus alias: a CNAME points a name such as app.mydomain.com to any other hostname, but not at the zone apex, its queries are charged and its TTL is set by the record owner; an alias points a name, even the apex mydomain.com, to an AWS resource, with free queries to AWS targets and automatic tracking of IP address changes

Two ways to point a custom name at an AWS name.

CNAME

  • Points a name to any other name: app.mydomain.com → blabla.anything.com.
  • Only for names below the apex, such as something.mydomain.com. Standard DNS doesn't allow a CNAME at the zone apex.
  • The TTL is set on the record, and Route 53 charges for the queries.

Alias records

An alias record is a Route 53 extension to DNS that points a name to an AWS resource: app.mydomain.com → blabla.amazonaws.com.

  • Works for the zone apex and below: mydomain.com as well as app.mydomain.com.
  • Always of type A (IPv4) or AAAA (IPv6). Route 53 answers with the resource's current IP addresses.
  • Automatically follows changes in the resource's IP addresses: load balancer IPs change all the time, and the alias keeps up.
  • Free: queries for alias records pointing to AWS resources aren't charged.
  • Native health check: with Evaluate target health on, Route 53 stops answering with an unhealthy target.
  • The TTL can't be set: Route 53 uses the resource's own TTL.

Alias targets

An alias can point to:

  • Elastic Load Balancing load balancers;
  • CloudFront distributions;
  • API Gateway APIs;
  • Elastic Beanstalk environments;
  • S3 buckets configured as websites;
  • VPC interface endpoints;
  • Global Accelerator accelerators;
  • App Runner services;
  • another Route 53 record in the same hosted zone.

An alias can't point to an EC2 instance's DNS name. Point an A record at its (Elastic) IP address instead.

Real-world examples

  • A company wants example.com (no www) to reach its ALB. A CNAME isn't allowed at the apex, so it creates an alias A record to the ALB.
  • A blog points www.example.com with a CNAME to example.github.io, a non-AWS host, where an alias isn't possible.

Exam tips

  • "Point the root domain (zone apex) to a load balancer or CloudFront" → alias record.
  • "Point a name to a non-AWS hostname" → CNAME (not at the apex).
  • "Avoid DNS query charges for AWS resources", "follow the load balancer's changing IPs" → alias.
  • "Alias to an EC2 instance" → not possible; use an A record with an Elastic IP.

Common traps

  • "Set a TTL of 60 seconds on an alias record." The TTL can't be set on an alias to an AWS resource.
  • "Create an A record with the load balancer's current IP." Its IPs change; use an alias.
  • "CNAME at the apex is fine in Route 53." It isn't; that's what alias records are for.

Check yourself

An alias lab needs an owned public domain, so instead:

AWS documentation

On this page

Open notes

Spotted a mistake?

These notes are open source. Suggest a fix, or star the repo if they helped you.

Suggest an edit

For AI agents: llms.txt · llms-full.txt