You can create a Canonical Name (CNAME) record to point a specified domain name to a CNAME that can resolve to an IP address. Application Load Balancer (ALB) supports CNAME records. You can create CNAME records to point your frequently used domain names to a CNAME that ALB uses to provide services. This allows you to access network resources in a convenient way.

DNS record types supported by SLB

A records and CNAME records are common DNS records. ALB provides domain names to allow external access and supports only CNAME records.
  • A records
    An A record points a domain name or a subdomain name to an IP address. You can create an A record to point a specified subdomain name to the IP address of your destination server. By default, Classic Load Balancer (CLB) provides public IP addresses to allow external access. To use a domain name to access a server, you can create an A record. The following figure shows the workflow.A records
  • CNAME records
    A CNAME record points a domain name or a subdomain name to a CNAME. You can create a CNAME record to point a specified subdomain name to a CNAME. By default, Application Load Balancer (ALB) provides domain names to allow external access. To use a custom domain name to access ALB, you must create a CNAME record and point the custom domain name to a CNAME. The following figure shows the workflow.CNAME records

Prerequisites

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

Configure a CNAME record to access ALB

  1. Log on to the ALB console.
  2. In the top navigation bar, select the region where the ALB instance that you want to manage is deployed.
  3. Find the ALB instance that you want to manage, and copy the 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.
      Notice Before you create the CNAME record, you must use a TXT record to verify the ownership of the domain name.
    4. In the Actions column of the domain name that you want to manage, click Configure.
    5. On the DNS Settings page, click Add Record.
    6. In the Add Record panel, set the following parameters and click Confirm.
      Parameter Description
      Type Select CNAME from the drop-down list.
      Host Enter the prefix of your domain name.
      ISP Line Select Default.
      Value Enter the CNAME. The CNAME is the domain name of the ALB instance that you copied in Step 3.
      TTL TTL: Time-to-live (TTL) limits the lifetime of the record on a server. In this example, the default value is used.
      Note
      • Newly created CNAME records immediately take effect. The time that is required for a modified CNAME record to take effect is limited by the TTL. The default value of 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.

Result

To test the CNAME record, ping or dig your custom domain name in the command line. If the CNAME of the ALB instance is displayed, this indicates that the CNAME record works as expected.