0
0
AwsHow-ToBeginner · 3 min read

How to Point Domain to ALB in AWS: Simple Steps

To point your domain to an AWS Application Load Balancer (ALB), create an Alias record in Amazon Route 53 that targets the ALB's DNS name. This connects your domain directly to the ALB without needing an IP address.
📐

Syntax

Use an Alias record in Route 53 to point your domain to the ALB. The key parts are:

  • Record Name: Your domain or subdomain (e.g., example.com or www.example.com).
  • Record Type: Use A for IPv4 or AAAA for IPv6.
  • Alias: Set to Yes to enable aliasing.
  • Alias Target: The DNS name of your ALB (e.g., my-alb-123456.us-east-1.elb.amazonaws.com).
text
Record Name: example.com
Record Type: A
Alias: Yes
Alias Target: my-alb-123456.us-east-1.elb.amazonaws.com.
💻

Example

This example shows how to create an alias record in Route 53 to point www.example.com to an ALB.

bash
aws route53 change-resource-record-sets --hosted-zone-id Z3P5QSUBK4POTI --change-batch '{
  "Changes": [{
    "Action": "UPSERT",
    "ResourceRecordSet": {
      "Name": "www.example.com.",
      "Type": "A",
      "AliasTarget": {
        "HostedZoneId": "Z35SXDOTRQ7X7K",
        "DNSName": "my-alb-123456.us-east-1.elb.amazonaws.com.",
        "EvaluateTargetHealth": false
      }
    }
  }]
}'
Output
{ "ChangeInfo": { "Id": "/change/C2682N5HXP0BZ4", "Status": "PENDING", "SubmittedAt": "2024-06-01T12:00:00Z", "Comment": "Upsert alias record to ALB" } }
⚠️

Common Pitfalls

  • Not using an Alias record and instead using a CNAME at the root domain, which is not allowed.
  • Using the wrong ALB DNS name or region-specific hosted zone ID.
  • Forgetting the trailing dot . at the end of domain names in Route 53 records.
  • Not waiting for DNS propagation after changes.
text
Wrong way:
Record Name: example.com
Record Type: CNAME
Value: my-alb-123456.us-east-1.elb.amazonaws.com

Right way:
Record Name: example.com
Record Type: A
Alias: Yes
Alias Target: my-alb-123456.us-east-1.elb.amazonaws.com.
📊

Quick Reference

StepActionNotes
1Find ALB DNS NameFrom AWS Console under Load Balancers
2Get ALB Hosted Zone IDUse AWS docs or CLI for region-specific ID
3Open Route 53Select your hosted zone for your domain
4Create Alias RecordSet record type A, alias Yes, target ALB DNS
5Save and WaitDNS changes can take minutes to propagate

Key Takeaways

Use an Alias A record in Route 53 to point your domain to the ALB DNS name.
Do not use CNAME records for root domains; Alias records are required.
Ensure you use the correct ALB DNS name and hosted zone ID for your region.
Remember to include trailing dots in domain names when configuring Route 53 records.
Allow time for DNS propagation after updating your records.