Point Domain Names to Application Load Balancer | AWS Certified Advanced Networking - Specialty

How to Point Domain Names to an Application Load Balancer

Prev Question Next Question

Question

You have created an Application Load Balancer.

You need to point your domain names of www.example.com and example.com to the Application Load Balancer.

Your Hosted zone is example.com.

How can you achieve this?

Answers

Explanations

Click on the arrows to vote for the correct answer

A. B. C. D.

Answer - B.

The AWS Documentation mentions below on ALIAS records which can be created.

Choosing Between Alias and Non-Alias Records.

Amazon Route 53 alias records provide a Route 53-specific extension to DNS functionality.

Alias records let you route traffic to selected AWS resources, such as CloudFront distributions and Amazon S3 bucket.

They also let you route traffic from one record in a hosted zone to another record.

Unlike a CNAME record, you can create an alias record at the top node of a DNS namespace known as the zone apex.

For example, if you register the DNS name example.com, the zone apex is example.com.

You can't create a CNAME record for example.com.

But you can create an alias record for example.com that routes traffic to www.example.com.

When Route 53 receives a DNS query for an alias record, Route 53 responds with the applicable value for that resource:

A CloudFront distribution - Route 53 responds with one or more IP addresses for CloudFront edge servers that can serve your content.

An Elastic Beanstalk environment - Route 53 responds with one or more IP addresses for the environment.

An ELB load balancer - Route 53 responds with one or more IP addresses for the load balancer.

An Amazon S3 bucket configured as a static website - Route 53 responds with one IP address for the Amazon S3 bucket.

Another Route 53 record in the same hosted zone - Route 53 responds as if the query is for the record referenced by the alias record.

You can then create a CNAME record for www.example.com.

Option A is incorrect because you cannot create a CNAME record at the zone apex.

Options C and D are incorrect since PTR records cannot be used.

For more information on alias and non-alias records, please refer to the below URL.

https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/resource-record-sets-choosing-alias-non-alias.html

To point the domain names www.example.com and example.com to an Application Load Balancer (ALB), you need to create DNS records in the Hosted Zone of the domain name example.com.

Among the answer options provided, the correct way to achieve this is by selecting option B:

B. Create an Alias record, for example.com and point it to the ALB as the target. Create a CNAME record for www.example.com and point it to example.com.

Explanation:

  1. Create an Alias record for example.com: An Alias record is a special type of DNS record in Amazon Route 53, which maps the domain name to an AWS resource such as an ALB. In this case, we will create an Alias record for example.com to point to the ALB. To create an Alias record, follow these steps:

    • Go to the Route 53 console and select the Hosted Zone for example.com.
    • Click the "Create Record Set" button and provide the following information:
      • Name: Leave this field empty to create a record for the root domain.
      • Type: Select "A - IPv4 address" from the dropdown menu.
      • Alias: Select "Yes" to create an Alias record.
      • Alias Target: Select the ALB from the list of available AWS resources.

    Once you have provided the required information, click the "Create" button to create the Alias record for example.com.

  2. Create a CNAME record for www.example.com: In addition to the Alias record, you also need to create a CNAME record for the subdomain www.example.com. This record should point to the root domain example.com. To create a CNAME record, follow these steps:

    • Go to the Route 53 console and select the Hosted Zone for example.com.
    • Click the "Create Record Set" button and provide the following information:
      • Name: Enter "www" in the Name field to create a record for the subdomain www.example.com.
      • Type: Select "CNAME - Canonical name" from the dropdown menu.
      • Value: Enter "example.com" in the Value field to point the CNAME record to the root domain.

    Once you have provided the required information, click the "Create" button to create the CNAME record for www.example.com.

With these two DNS records in place, traffic to the domain names www.example.com and example.com will be directed to the Application Load Balancer.