Amazon Route 53
Developer Guide (API Version 2013-04-01)
« PreviousNext »
View the PDF for this guide.Go to the AWS Discussion Forum for this product.Go to the Kindle Store to download this guide in Kindle format.Did this page help you?  Yes | No |  Tell us about it...

How to Create Alias Resource Record Sets

You can create alias resource record sets using the Amazon Route 53 console or the Amazon Route 53 API. See the applicable topic:

For information about creating latency resource record sets that route queries to Elastic Load Balancing load balancers based on the latency between an end user and your load balancers in multiple Amazon EC2 regions, see Creating Latency Resource Record Sets.

Creating Alias Resource Record Sets Using the Amazon Route 53 Console

To create alias resource record sets using the Amazon Route 53 console

  1. If you're creating an alias resource record set for:

    • An AWS resource other than an Elastic Load Balancing load balancer, skip to Step 2.

    • A load balancer and you created both your Amazon Route 53 hosted zone and your Elastic Load Balancing load balancer using the same AWS account, skip to Step 2.

    • A load balancer and you created the hosted zone and the load balancer using different accounts, perform the following steps to get the DNS name for the load balancer:

    1. Sign in to the AWS Management Console using the AWS account that was used to create the load balancer for which you want to create an alias resource record set.

    2. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

    3. In the left navigation pane, click Load Balancers.

    4. In the list of load balancers, select the load balancer for which you want to create a Amazon Route 53 alias resource record set.

    5. In the bottom pane, on the Description tab, get the applicable value for DNS Name:

      • If you're creating an A record (if your users use only IPv4 addresses, xxx.xxx.xxx.xxx): Get the DNS name that is labeled A Record.

      • If you're creating a AAAA record (if your users use only IPv6 addresses, xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx): Get either the DNS name that is labeled AAAA Record or the DNS name that is labeled A or AAAA Record.

      EC2: getting the DNS name and hosted zone ID for a load balancer.

    6. Sign out of the AWS Management Console.

    7. Sign in to the AWS Management Console again using the AWS account that was used to create the Amazon Route 53 hosted zone.

  2. Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.

  3. In the Amazon Route 53 console, do one of the following to display the record sets for the hosted zone in which you want to create alias resource record sets:

    • Click the row for the hosted zone, and click Go to Record Sets.

    • Double-click the row for the hosted zone.

    Creating a resource record set: Go to Record Sets button on the Hosted Zones page.

  4. Click Create Record Set.

  5. Enter the applicable values:

    Name

    Enter the name of the domain or subdomain for which you're creating an alias resource record set. The default value is the name of the hosted zone.

    Type

    Select the applicable value:

    • If you're creating an alias resource record set for a CloudFront distribution, an Amazon EC2 instance, an Elastic Load Balancing load balancer, or an Amazon S3 bucket, select A - Ipv4 address.

    • If you're creating an alias resource record set for another resource record set in this hosted zone, select the type of the resource record set for which you're creating the alias.

    Alias

    Click Yes.

    Alias Target

    For CloudFront distributions, do one of the following:

    • If you used the same account to create your Amazon Route 53 hosted zone and your CloudFront distribution: Click Alias Target and choose a distribution from the list. If you have a lot of distributions, you can type the first few characters of the domain name for your distribution to filter the list.

      If your distribution doesn't appear in the list, note the following:

      • The name of this resource record set must match an alternate domain name in your distribution.

      • If you just added an alternate domain name to your distribution, it may take 15 minutes for your changes to propagate to all CloudFront edge locations. Until changes have propagated, Amazon Route 53 can't know about the new alternate domain name.

    • If you used different accounts to create your Amazon Route 53 hosted zone and your distribution: Enter the CloudFront domain name for the distribution; for example, d111111abcdef8.cloudfront.net.

    Important

    Do not route queries to a CloudFront distribution that has not propagated to all edge locations, or your users won't be able to access the applicable content.

    For Elastic Load Balancing load balancers, do one of the following:

    • If you used the same account to create your Amazon Route 53 hosted zone and your load balancer: Click Alias Target and choose a load balancer from the list. If you have a lot of load balancers, you can type the first few characters of the DNS name to filter the list.

    • If you used different accounts to create your Amazon Route 53 hosted zone and your load balancer: Enter the value that you got in Step 1 for the DNS name of the load balancer.

    For Amazon S3 buckets, do one of the following:

    • If you used the same account to create your Amazon Route 53 hosted zone and your Amazon S3 bucket: Click Alias Target and choose a bucket from the list. If you have a lot of buckets, you can type the first few characters of the DNS name to filter the list.

      The value of Alias Target changes to the Amazon S3 website endpoint for your bucket.

    • If you used different accounts to create your Amazon Route 53 hosted zone and your Amazon S3 bucket: Enter the domain name of the Amazon S3 website endpoint in the following format:

      s3-website-region.amazonaws.com

      The region value represents the Amazon S3 region in which the bucket is hosted; for example, us-east-1.

    For resource record sets in this hosted zone, click Alias Target and choose the applicable resource record set. If you have a lot of resource record sets, you can type the first few characters of the name to filter the list.

    Alias Hosted Zone ID

    This value appears automatically based on the value that you selected or entered for Alias Target.

    Routing Policy

    Choose the applicable value:

    • Simple: Amazon Route 53 responds to queries based only on the values in this resource record set.

    • Weighted: Amazon Route 53 responds to queries based on weighting that you specify in this and other record sets that have the same name and type. For more information about creating weighted alias resource record sets, see How to Create Weighted Alias Resource Record Sets.

    • Latency: Amazon Route 53 responds to queries based on regions that you specify in this and other record sets that have the same name and type. For more information about latency resource record sets, see Creating Latency Resource Record Sets.

    • Failover: Amazon Route 53 responds to queries using the resources that are associated with the primary resource record set, if any are healthy, or using the resources that are associated with the secondary resource record set otherwise. For more information about failover resource record sets, see Configuring Active-Passive Failover Using Amazon Route 53 Failover and Failover Alias Resource Record Sets.

    Evaluate Target Health

    Select Yes if you want Amazon Route 53 to determine whether to respond to DNS queries using this resource record set by checking the health of the resource record set specified by Alias Target. Note the following:

    • You cannot set Evaluate Target Health to Yes when the alias target is a CloudFront distribution.

    • If the AWS resource that you specify in Alias Target is a resource record set or a group of resource record sets (for example, a group of weighted resource record sets), but it is not another alias resource record set, we recommend that you associate a health check with all of the resource record sets in the alias target. For more information, see What Happens When You Omit Health Checks?.

    • If you specify an Elastic Load Balancing load balancer in Alias Target, Elastic Load Balancing routes queries only to the healthy Amazon EC2 instances that are registered with the load balancer. If no Amazon EC2 instances are healthy or if the load balancer itself is unhealthy, and if Evaluate Target Health is Yes for the corresponding alias resource record set, Amazon Route 53 routes queries to other resources.

      When you create a load balancer, you configure settings for Elastic Load Balancing health checks; they're not Amazon Route 53 health checks, but they perform a similar function. Do not create Amazon Route 53 health checks for the Amazon EC2 instances that you register with an Elastic Load Balancing load balancer.

      For more information, see How Health Checks Work in More Complex Amazon Route 53 Configurations.

    • We recommend that you set Evaluate Target Health to Yes only when you have enough idle capacity to handle the failure of one or more endpoints.

    Creating an alias resource record set.

  6. Click Create Record Set.

Creating Alias Resource Record Sets Using the Amazon Route 53 API

To create alias resource record sets, you use the ChangeResourceRecordSets action. For more information, see POST ChangeResourceRecordSets in the Amazon Route 53 API Reference.

The example below assumes the following:

  • Z222222222 is the ID of the Amazon Route 53 hosted zone in which you're creating the alias resource record set.

  • example.com is the zone apex for which you want to create an alias.

  • www.example.com is a subdomain for which you also want to create an alias.

  • Z1111111111111 is an example of a hosted zone ID for the load balancer. You can get the value of the load balancer's hosted zone ID, CanonicalHostedZoneNameID, in the following ways:

    • Use the AWS Management Console. On the EC2 page, click Load Balancers in the Navigation pane.

    • Use the DescribeLoadBalancers action. For more information, see "Actions" in the Elastic Load Balancing API Reference.

    • Use the Elastic Load Balancing elb-describe-lbs CLI command. For more information about this CLI command, see the Elastic Load Balancing Quick Reference Card or the Elastic Load Balancing CLI help.

    If you are routing queries to:

    • A CloudFront distribution: Specify Z2FDTNDATAQYW2.

    • An Amazon S3 bucket that is configured as a static website: Specify the hosted zone ID for the Amazon S3 website endpoint in which you created the bucket. For more information about valid values, see the table Amazon Simple Storage Service (S3) Website Endpoints in the Amazon Web Services General Reference.

    • Another Amazon Route 53 resource record set in your hosted zone: Specify the hosted zone ID of your hosted zone. (An alias resource record set cannot reference a resource record set in a different hosted zone.)

  • example-load-balancer-1111111111.us-east-1.elb.amazonaws.com is an example of a load balancer domain name with which Amazon Route 53 responds to queries for example.com and www.example.com.

    You can get the domain name for a load balancer by using the same methods you used to get the hosted zone ID for the load balancer.

Note

You can also create an alias resource record set by using the elb-associate-route53-hosted-zone CLI command. For more information about the CLI command, see the Elastic Load Balancing Quick Reference Card or the Elastic Load Balancing CLI help.

POST /2013-04-01/hostedzone/Z222222222/rrset HTTP/1.1
<?xml version="1.0" encoding="UTF-8"?>
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/
doc/2013-04-01/">
   <ChangeBatch>
      <Comment>
      This change batch creates two alias resource record sets, one 
      for the zone apex, example.com, and one for www.example.com, that both 
      point to example-load-balancer-1111111111.us-east-1.elb.amazonaws.com.
      </Comment>
      <Changes>
         <Change>
            <Action>CREATE</Action>
               <ResourceRecordSet>
                  <Name>example.com.</Name>
                  <Type>A</Type>
                  <AliasTarget>
                     <HostedZoneId>Z1111111111111</HostedZoneId>
                     <DNSName>example-load-balancer-1111111111.us-east-1.elb.amazonaws.com.</DNSName>
                  </AliasTarget>
               </ResourceRecordSet>
         </Change>
         <Change>
            <Action>CREATE</Action>
               <ResourceRecordSet>
                  <Name>www.example.com.</Name>
                  <Type>A</Type>
                  <AliasTarget>
                     <HostedZoneId>Z1111111111111</HostedZoneId>
                     <DNSName>example-load-balancer-1111111111.us-east-1.elb.amazonaws.com.</DNSName>
                  </AliasTarget>
               </ResourceRecordSet>
         </Change>
      </Changes>
   </ChangeBatch>
</ChangeResourceRecordSetsRequest>

After you send your change request, check to ensure that your change was applied to all Amazon Route 53 DNS servers by polling for the status of the change. When the change is complete, its status becomes INSYNC. For more information about polling for the status of a change request, see Checking the Status of Your Change.