| Did this page help you? Yes No Tell us about it... |
Topics
Each Elastic Load Balancing instance that you create has a unique Domain Name System (DNS) name. For example, if you create a load balancer named myLB in the US-East Region, your load balancer might have a DNS name such as myLB-1234567890.us-east-1.elb.amazonaws.com.
If you'd rather use a custom domain name, such as www.example.com, instead of the load balancer DNS name, you can map the custom domain name to the load balancer DNS name. You have two optionseither create a Canonical Name (CNAME) record with your existing domain name provider or use Amazon Route 53 to create a hosted zone. A hosted zone is an Amazon Route 53 concept that is similar to a zone file on a DNS name server. Like a zone file, a hosted zone contains information about a domain name, including names within the domain and mappings between names and IP addresses.
This section describes how to associate your Elastic Load Balancing instance with a custom domain nameincluding subdomain names and the zone apex. When you register a domain name, you reserve not only the domain name itself, but also an entire set of subdomain names. For example, if you register example.com, you can create subdomain names such as www.example.com and foo.bar.example.com. This set of a domain and its subdomain names is called a zone, and a domain name that you reserve, such as example.com, is called the zone apex because it sits atop the zone's hierarchy.
![]() | Important |
|---|---|
This section assumes that you've reserved a domain name. For a list of registrar web sites you can use to register your domain name, go to ICANN.org. |
![]() | Note |
|---|---|
The Time-to-Live (TTL) for an ELB DNS entry is set to 60 seconds. This setting ensures that IP addresses can be re-mapped quickly to respond to events that cause ELB to scale up or down. |
Before you get started, be sure you've done the following:
Created a load balancer with Elastic Load Balancing. For information on how to set up a HTTPS/SSL load balancer with the AWS Management Console, command line interfaces (CLI), or Query API, see Creating a Load Balancer With SSL Cipher Settings and Back-end Server Authentication. To learn how to set up a HTTP/TCP load balancer with the AWS Management Console, see Get Started with Elastic Load Balancing.
Installed the Elastic Load Balancing tool/s that you plan to use to perform load balancing tasks. You can associate your Elastic load Balancing instance with a custom domain name using command line interface (CLI) or the Query API. This functionality is currently not available in the AWS Management Console. For information on installing the command line interface or the Query API, see Get Set Up with Elastic Load Balancing Interfaces.
For detailed descriptions of the Elastic Load Balancing Query API actions, see Elastic Load Balancing API Reference.
For detailed descriptions of the Elastic Load Balancing commands, see the Elastic Load Balancing Quick Reference Card.
You've registered a domain name for your load balancer. For a list of registrar web sites you can use to register your domain name, go to ICANN.org.
To use a subdomain name that directs traffic to your load balancer, create a CNAME record that associates the subdomain name with your load balancer. The advantage of this method is that creation of CNAME records can be a simple process.
The disadvantage of this method is that you can't use a CNAME record to associate your zone apex with your Elastic Load Balancing instance. DNS rules prohibit the creation of a CNAME record at the zone apex (e.g., example.com). For example, if you own the example.com domain name, you can use a CNAME record for the www.example.com subdomain name, but not for the example.com zone apex. To create a zone apex alias that points to your Elastic Load Balancing instance, use Amazon Route 53.
To associate a subdomain with an Elastic Load Balancing instance
Retrieve the public DNS name of your load balancer.
If you created a LoadBalancer in the previous step, the public DNS name is available as
the return value for calls to the CLI command
elb-create-lb and the Query API action
CreateLoadBalancer. If you are using an existing
load balancer, use elb-describe-lbs or
DescribeLoadBalancers to retrieve your load
balancer's public DNS name. You can also find your load balancer's DNS name
in the AWS Management Console. Look in your load balancer's detail section.
Create a CNAME record with your subdomain name and your load balancer's public DNS name.
Ask the company that provides your DNS name services (your domain name registrar) to create a CNAME record for your zone. Many domain name registrars provide self-service tools that you can use to create the CNAME record yourself. The following example shows a CNAME record that associates an alias, www.example.com, with a canonical name, the DNS name of an Elastic Load Balancing instance.
www.example.com CNAME myLB-1234567890.us-east-1.elb.amazonaws.com
To map a zone apex (e.g., example.com) to your load balancer, use Amazon Route 53 to create a hosted zone for your domain, then use Elastic Load Balancing to add a zone apex alias to your hosted zone. The zone apex alias associates your zone apex with your Elastic Load Balancing instance. After you create a hosted zone, you can also associate subdomain names with your Elastic Load Balancing instance.
Two separate hosted zones make the zone apex alias possible:
The custom hosted zone that you create for your domain name with Amazon Route 53.
The Elastic Load Balancing hosted zone for the Region that contains your load balancer.
For each Region, Elastic Load Balancing maintains a hosted zone that contains the public DNS names for all
load balancers in that Region. You can find the Elastic Load Balancing hosted zone ID for your Region
by calling the DescribeLoadBalancers API action or the
elb-describe-lbs CLI command. You can also find the Elastic Load Balancing
hosted zone ID in the AWS Management Console.
![]() | Note |
|---|---|
The hosted zone ID listed in your load balancer's Description tab is the Elastic Load Balancing hosted zone ID, not your custom hosted zone ID. |
If you use the CLI to associate or disassociate domain names, you do not need to use the Elastic Load Balancing hosted zone ID. You need only your custom hosted zone ID and your domain name. If you prefer to use the Amazon Route 53 Query API, however, you need both your custom hosted zone ID and the Elastic Load Balancing hosted zone ID for your LoadBalancer's Region.
![]() | Note |
|---|---|
This section assumes that you've registered a domain name. For a list of registrar web sites you can use to register your domain name, go to ICANN.org. |
To associate a zone apex with an Elastic Load Balancing instance
Create an Amazon Route 53 hosted zone for your domain name.
If you haven't used Amazon Route 53 before, go to the Amazon Route 53 Getting Started Guide and follow the instructions to create your hosted zone.
![]() | Important |
|---|---|
Note the ID of your hosted zone. You'll need the ID to associate your hosted zone with a load balancer. |
Create a LoadBalancer with Elastic Load Balancing or choose an existing load balancer.
For information on how to set up an HTTP/HTTPS load balancer with the AWS Management Console, command line interfaces (CLI) or Query API, see Creating a Load Balancer With SSL Cipher Settings and Back-end Server Authentication . To learn how to set up an HTTP load balancer with the AWS Management Console, see Get Started with Elastic Load Balancing.
For detailed descriptions of the Elastic Load Balancing Query API operations, see Elastic Load Balancing API Reference. For descriptions of all the Elastic Load Balancing commands, see Elastic Load Balancing Quick Reference Card.
![]() | Note |
|---|---|
If you create a new load balancer, wait a few seconds before moving on to the next
step. The load balancer's public DNS name can take several seconds
to become available to Amazon Route 53. Calls to
|
Enter the elb-associate-route53-hosted-zone command.
This command creates an association between your zone apex and your Elastic Load Balancing instance by adding an alias resource record set to your hosted zone. The following example creates an association between example.com and a load balancer named myLoadBalancer.
elb-associate-route53-hosted-zone myLoadBalancer --rr-name example.com --hosted-zone-id Z123456789 --weight 100
![]() | Note |
|---|---|
For the |
You might have to wait several minutes for your changes to propagate to all Amazon Route 53 DNS servers. For information on how to check the status of your change, go to Checking the Status of Your Change in the Amazon Route 53 Developer Guide.
You can also use elb-associate-route53-hosted-zone to create aliases for subdomains that are part of your hosted zone. The following example associates the subdomain www.example.com to a customer's Amazon Route 53 hosted zone with ID number Z123456789.
elb-associate-route53-hosted-zone myLoadBalancer --rr-name www.example.com --hosted-zone-id Z123456789 --weight 100
![]() | Note |
|---|---|
Both the |
To remove an association between a zone apex or subdomain and your load balancer, use
elb-disassociate-route53-hosted-zone to delete the
appropriate alias resource record set from your hosted zone. The following
example removes the association between the zone apex example.com and the load
balancer named myLb.
To disassociate a zone apex from an Elastic Load Balancing instance
Enter the elb-disassociate-route53-hosted-zone command.
This command removes the association between your zone apex or subdomain and your
Elastic Load Balancing instance by deleting an alias resource record set
from your hosted zone. The following example removes an association
between example.com and a load balancer named myLB. The
hosted-zone-id parameter is your custom
hosted zone ID.
elb-disassociate-route53-hosted-zone myLB --rr-name example.com --hosted-zone-id Z123456789 --weight 100
![]() | Note |
|---|---|
The |
If you prefer to configure your alias resource record sets with the Query API, you must use the Amazon Route 53 API. You can configure your AliasTarget (obtained from the DescribeLoadBalancers API or elb-describe-lbs CLI) with the following:
The value of the CANONICAL_HOSTED_ZONE_NAME specifies the value of the DNSName element in the AliasTarget.
The value of the CANONICAL_HOSTED_ZONE_NAME_ID specifies the value of the HostedZoneId element in the AliasTarget.
For more information on creating alias resource record sets, go to Creating Alias Resource Record Sets in the Amazon Route 53 Developer Guide.