I want to create alias records in Amazon Route 53 for AWS hosted services and want to know which record type to use.
Resolution
Create an alias record
To create your alias record in the Route 53 console and specify the values for simple alias record, complete the following steps:
- Open the Route 53 console.
- Choose Create Record in your hosted zone.
- Choose Record type:
- For AWS services, create an A record (IPv4 address) or AAAA record (IPv6 address).
- Select the alias target that's the AWS resource that you want to route traffic to.
Verify that you use the correct DNS record type for IP addresses in the service that you want to point to:
- For an Amazon CloudFront distribution, use an A record (IPv4) or AAAA record (IPv6).
- For an AWS Elastic Beanstalk environment, use an A record (IPv4).
- For an Elastic Load Balancing load balancer, use an A record (IPv4) or AAAA record (IPv6).
- For an Amazon Simple Storage Service (Amazon S3) bucket, use an A record (IPv4).
- For an Amazon API Gateway custom Regional API and edge-optimized API, use an A record (IPv4).
- For an Amazon Virtual Private Cloud (Amazon VPC) interface endpoint, use an A record (IPv4).
- For AWS Global Accelerator, use an A record (IPv4).
- For AWS AppSync, use an A record (IPv4).
- For AWS App Runner, use an A record (IPv4).
- Use Another Route 53 record in the same hosted zone.
Note: Amazon API Gateway and Amazon CloudFront require you to setup a custom DNS name.
Set up CNAME support in alias records
Route 53 follows the pointer in an alias record only if the record type matches. To create an alias record for a CNAME record, the alias target must resolve to a CNAME value.
If you create a CNAME(ALIAS) record that's not valid, then Route 53 can't resolve the IP address of the endpoint. As a result, Route 53 returns an "SERVFAIL/REFUSED RCODE" error.
Valid CNAME(ALIAS) record
| | |
|---|
| Name | Type | Value |
| cname.example.com. | CNAME(ALIAS) | cname1.example.com |
| cname1.example.com. | CNAME | abc.example.net |
| abc.example.net. | A | 203.0.113.1 |
Point from non-Route 53 DNS providers
If you use a DNS provider other than Route 53 for your domain, then you can point the domain to AWS services. To check if your DNS provider supports CNAME records on a root domain, use techniques such as CNAME flattening, ANAME records, or WebHops Redirect.
Create CNAME records
For Parent, Naked, or Apex domains, use an alias record to point the parent domain to other supported alias targets instead of a CNAME record. For example:
example.com Alias(A) dualstack.elb123.us-east-1.elb.amazonaws.com
For subdomains, you can create CNAME records. For example:
subdomain.example.com CNAME destination.example.com
To have multiple record types for the same domain, use a combination of CNAME and wildcard records. For example:
abc.example.com CNAME www.example.com
abc.example.com A 192.0.2.1
Related information
Why can't I select my preferred alias target when I create a Route 53 alias resource record set?
Choosing between alias and non-alias records