All Products
Search
Document Center

Server Load Balancer:Add a CNAME record to an ALB instance

Last Updated:Dec 20, 2023

This topic describes how to add a CNAME record to an Application Load Balancer (ALB) instance to map a custom domain name to the public domain name of the ALB instance.

Overview

A CNAME record is a type of DNS record that maps an alias name to another domain name. You can use a CNAME record to map a custom domain name to the domain name of your ALB instance so that your ALB instance can be accessed through the custom domain name. The following figure shows how a CNAME record works.

image

Prerequisites

An ALB instance is created. For more information, see Create an ALB instance.

Procedure

  1. Log on to the ALB console.

  2. In the top navigation bar, select the region where the ALB instance is deployed.

  3. Find the ALB instance that you want to manage and copy its domain name.

  4. To create a CNAME record, perform the following operations:

    1. Log on to the Alibaba Cloud DNS console.

    2. On the Manage DNS page, click Add Domain Name.

    3. In the Add Domain Name dialog box, enter the domain name of your host and click OK.

      Important

      Before you create the CNAME record, you must use a TXT record to verify the ownership of the domain name.

    4. Find the domain name that you want to manage and click DNS Settings in the Actions column.

    5. On the DNS Settings page, click Add Record.

    6. In the Add DNS Record panel, configure the following parameters and click OK.

      Parameter

      Description

      Record Type

      Select CNAME from the drop-down list.

      Hostname

      Enter the prefix of your domain name.

      DNS Request Source

      Select Default.

      Record Value

      Enter the CNAME, which is the domain name of the ALB instance.

      TTL

      Select a time-to-live (TTL) value for the CNAME record to be cached on the DNS server. The default value is used in this example.

      Note
      • After you create a CNAME record, it immediately takes effect. After you modify a record, the record takes effect based on the TTL of the record. By default, the TTL is 10 minutes.

      • If the CNAME record that you want to create conflicts with an existing record, we recommend that you specify another domain name. For more information, see Rules for conflicting DNS records.

What to do next

Check whether the CNAME record takes effect. Run the ping or dig command in your command-line interface (CLI) to access the custom domain name. If the ping or dig packet is redirected to the domain name of the ALB instance, it indicates that the CNAME record takes effect.

References

The following topics describe how to map multiple domain names to the domain name of an ALB instance to distribute requests to different backend servers: