Skip to content

How do I create alias records in Route 53 for AWS hosted services?

3 minute read
0

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:

  1. Open the Route 53 console.
  2. Choose Create Record in your hosted zone.
  3. Choose Record type:
  4. For AWS services, create an A record (IPv4 address) or AAAA record (IPv6 address).
  5. 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

NameTypeValue
cname.example.com.CNAME(ALIAS)cname1.example.com
cname1.example.com.CNAMEabc.example.net
abc.example.net.A203.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

1 Comment

I created an alias for @ record in the domain, it is showing no error while testing in the console, however DNS queries returns no value:

example.com Alias(A) dualstack.elb123.us-east 1.elb.amazonaws.com.

Similar non-root record works as expected:

test.example.com Alias(A) dualstack.elb123.us-east 1.elb.amazonaws.com.
$ host -vvv -t A example.com ns-1889.awsdns-44.co.uk.
Trying "example.com"
Using domain server:
Name: ns-1889.awsdns-44.co.uk.
Address: 2600:9000:5307:6100::1#53
Aliases: 

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 9888
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com.			IN	A

;; AUTHORITY SECTION:
example.com.		900	IN	SOA	ns-1889.awsdns-44.co.uk. awsdns-hostmaster.amazon.com. 1 7200 900 1209600 86400

Received 114 bytes from 2600:9000:5307:6100::1#53 in 20 ms

Is it actually possible to have working alias for root (@) A record in the domain?

replied a year ago