Route 53
ALB
AWS
DNS
cloud infrastructure

How can I create a Route 53 Record to an ALB? AWS

Master System Design with Codemia

Enhance your system design skills with over 120 practice problems, detailed solutions, and hands-on exercises.

Introduction

To point a domain name at an AWS Application Load Balancer, the correct Route 53 record type is usually an alias record, not a plain CNAME. Alias records integrate with AWS load balancers, work at the zone apex, and avoid some of the DNS limitations that affect CNAME records. The main task is to map a record in your hosted zone to the ALB DNS name and its canonical hosted zone ID.

Use an Alias Record for an ALB

An ALB already has a DNS name that looks something like my-app-123456.us-east-1.elb.amazonaws.com. You normally do not expose that name directly to users. Instead, you create a Route 53 record such as app.example.com or even the root domain example.com.

For ALBs, Route 53 alias records are preferred because:

  • they can point the root domain at the load balancer
  • Route 53 understands the AWS target type directly
  • the record follows ALB DNS changes automatically
  • you do not manage a separate TTL on the alias target

A plain CNAME can work for a subdomain, but it is the wrong choice for the zone apex and is usually unnecessary when both services are in AWS.

Create the Record in the Console

In the AWS console, the flow is straightforward:

  1. open Route 53
  2. open the hosted zone for your domain
  3. choose Create record
  4. enter the record name such as app for app.example.com
  5. leave the type as A for IPv4, or create both A and AAAA if you want dual stack support
  6. turn on Alias
  7. choose Alias to Application and Classic Load Balancer
  8. select the region and the ALB
  9. save the record

If the hosted zone and load balancer are in the same AWS account, the console often lets you pick the ALB from a list. If they are in different accounts, you may need to enter the target values manually.

Create the Record with the AWS CLI

For infrastructure work, it is often better to do this from the CLI or an infrastructure-as-code template. The key values are:

  • the hosted zone ID for your Route 53 zone
  • the ALB DNS name
  • the ALB canonical hosted zone ID

You can fetch the ALB values with elbv2 describe-load-balancers.

bash
1ALB_NAME=my-app-alb
2HOSTED_ZONE_ID=Z123456789EXAMPLE
3RECORD_NAME=app.example.com.
4
5ALB_DNS_NAME=$(aws elbv2 describe-load-balancers \
6  --names "$ALB_NAME" \
7  --query 'LoadBalancers[0].DNSName' \
8  --output text)
9
10ALB_ZONE_ID=$(aws elbv2 describe-load-balancers \
11  --names "$ALB_NAME" \
12  --query 'LoadBalancers[0].CanonicalHostedZoneId' \
13  --output text)
14
15cat > /tmp/route53-alias.json <<JSON
16{
17  "Comment": "Create alias record for ALB",
18  "Changes": [
19    {
20      "Action": "UPSERT",
21      "ResourceRecordSet": {
22        "Name": "$RECORD_NAME",
23        "Type": "A",
24        "AliasTarget": {
25          "HostedZoneId": "$ALB_ZONE_ID",
26          "DNSName": "$ALB_DNS_NAME",
27          "EvaluateTargetHealth": false
28        }
29      }
30    }
31  ]
32}
33JSON
34
35aws route53 change-resource-record-sets \
36  --hosted-zone-id "$HOSTED_ZONE_ID" \
37  --change-batch file:///tmp/route53-alias.json

That command is realistic and repeatable. It is also useful in CI pipelines where DNS changes are versioned alongside application deployments.

CloudFormation Example

If you manage AWS resources with CloudFormation, an alias record looks like this:

yaml
1Resources:
2  AppAliasRecord:
3    Type: AWS::Route53::RecordSet
4    Properties:
5      HostedZoneName: example.com.
6      Name: app.example.com.
7      Type: A
8      AliasTarget:
9        DNSName: !GetAtt ApplicationLoadBalancer.DNSName
10        HostedZoneId: !GetAtt ApplicationLoadBalancer.CanonicalHostedZoneID
11        EvaluateTargetHealth: false

This is a good option when the ALB and DNS record belong to the same stack or to stacks that export values cleanly.

Root Domain Versus Subdomain

A detail that matters in practice is whether you are pointing example.com or app.example.com.

For example.com, an alias A record is the standard Route 53 solution. A CNAME at the zone apex is not valid in normal DNS setups.

For app.example.com, both alias and CNAME are technically possible, but alias still tends to be the better AWS-native choice. It keeps the configuration consistent and avoids special cases later.

If you also need IPv6, create an alias AAAA record in addition to the A record, assuming the ALB is configured for dual-stack access.

Common Pitfalls

The most common mistake is using the wrong hosted zone ID. Route 53 needs the ALB canonical hosted zone ID, not the hosted zone ID of your domain.

Another mistake is creating a CNAME at the root domain. That usually fails because apex records cannot be CNAMEs in standard DNS.

Cross-account setups are another source of confusion. The console may not auto-discover the load balancer if the hosted zone and ALB live in different accounts, so the CLI or infrastructure code becomes more reliable.

Finally, do not confuse ALBs with CloudFront distributions. The alias target type and operational behavior are different, even though both are Route 53 alias destinations.

Summary

  • Point Route 53 records at an ALB with an alias record, usually type A
  • Alias records are preferred over CNAMEs for AWS load balancers
  • The critical target values are the ALB DNS name and canonical hosted zone ID
  • Use the console for one-off changes and the CLI or CloudFormation for repeatable changes
  • Use alias records at the root domain because CNAMEs are not suitable there
  • Add an AAAA alias too if you need IPv6 support

Course illustration
Course illustration