Configure a Custom Domain Name for Your Load Balancer
Each load balancer receives a default Domain Name System (DNS) name. This
DNS name includes the name of the AWS region in which the load balancer is created. For example,
if you create a load balancer named
my-loadbalancer in the US West (Oregon) region,
your load balancer receives a DNS name such as
To access the website on your back-end instances, you paste this DNS name into the address field
of a web browser. However, this DNS name is not easy for your customers to remember and use.
If you'd prefer to use a friendly DNS name for your load balancer, such as
instead of the default DNS name, you can create a custom domain name and associate it with the DNS
name for your load balancer. When a request is placed to your load balancer using this
custom domain name, the DNS server resolves to the DNS name for your load balancer.
Associating Your Custom Domain Name with Your Load Balancer Name
First, if you haven't already done so, register your domain name. The Internet Corporation for Assigned Names and Numbers (ICANN) manages domain names on the Internet. You register a domain name using a domain name registrar, an ICANN-accredited organization that manages the registry of domain names. The website for your registrar will provide detailed instructions and pricing information for registering your domain name. For more information, see the following resources:
If you have a domain name but are using another DNS service, such as your domain registrar, consider the option to use Amazon Route 53 as your DNS service. When you use Amazon Route 53 as your DNS service, you can create an alias resource record set, which has the following advantages over other DNS services for routing DNS queries to your load balancer:
Amazon Route 53 doesn't charge for DNS queries for alias resource record sets.
You can use alias record sets to route DNS queries to your load balancer for the zone apex of your domain (for example,
example.com). If you're using a different DNS service, you need to create a CNAME resource record set to route queries to your load balancer, but DNS doesn't allow you to create a CNAME resource record set for the zone apex. (Note that some DNS services provide a workaround.)
For information about transferring DNS services for existing domains to Amazon Route 53, see Configuring Amazon Route 53 as Your DNS Service in the Amazon Route 53 Developer Guide.
For information about using Amazon Route 53 with your load balancer, see Routing Queries to an Elastic Load Balancing Load Balancer in the Amazon Route 53 Developer Guide.
Configure DNS Failover for Your Load Balancer
When you use Amazon Route 53 to route DNS queries to your load balancer, you can configure DNS failover for your load balancer. In a failover configuration, Amazon Route 53 checks the health of the registered EC2 instances for the load balancer to determine whether they are available. If there are no healthy EC2 instances registered with the load balancer, or if the load balancer itself is unhealthy, Amazon Route 53 routes traffic to another available resource, such as a healthy load balancer or a static website in Amazon S3.
For example, suppose that you have a web application for
www.example.com, and you want
redundant instances running behind two load balancers residing in different regions.
You want the traffic to be primarily routed to the load balancer in one region, and you
want to use the load balancer in the other region as a backup during failures. If you configure
DNS failover, you can specify your primary and secondary (backup) load balancers. Amazon Route 53
directs traffic to the primary load balancer if it is available, or
to the secondary load balancer otherwise.
To configure DNS failover for two load balancers using Amazon Route 53
Open the Amazon Route 53 console at https://console.aws.amazon.com/route53/.
In the navigation pane, choose Hosted Zones.
Select the name of your hosted zone.
Click Create Record Set.
In Name, the default value is the name of your domain (for example,
example.com). To route DNS queries for a subdomain (for example,
apex.example.com) to your load balancer, specify the name of the subdomain.
In Type, select A - Ipv4 address.
For Alias, click Yes
Click Alias Target, and choose your primary load balancer from the list.
The value of Alias Hosted Zone ID appears automatically based on the load balancer that you chose for Alias Target.
For Routing Policy, select Failover.
For Failover Record Type, select Primary.
For Set ID, enter an ID for the record set or use the default value.
For Evaluate Target Health, select Yes.
For Associate with Health Check, select No.
Repeat the same steps to create an alias record set for your secondary load balancer, with the following exceptions:
In Alias Target, choose your secondary load balancer.
For Failover Record Type, select Secondary.
For Evaluate Target Health, select Yes to evaluate the health of the secondary load balancer. If the secondary load balancer is unhealthy, Amazon Route 53 routes traffic to the primary load balancer. If you select No, Amazon Route 53 assumes that the secondary load balancer is healthy and routes traffic to it whenever the primary load balancer is unhealthy.
For information about setting up advanced DNS failover configurations, see Configuring Amazon Route 53 Active-Active and Active-Passive Failover in the Amazon Route 53 Developer Guide.
Disassociating Your Custom Domain Name from Your Load Balancer
You can disassociate your custom domain name from a load balancer instance by first deleting the resource record sets in your hosted zone and then deleting the hosted zone. For more information, see Creating, Changing, and Deleting Resource Record Sets and Deleting a Hosted Zone in the Amazon Route 53 Developer Guide.