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

DNS record types supported by ALB

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 maps 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, Application Load Balancer (ALB) 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 maps 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 map 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

  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 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 the domain name of your host.
      ISP Line Select Default.
      Value Enter the CNAME. The CNAME is the domain name of the ALB instance.
      TTL Select the time-to-live (TTL) value of the record on the DNS 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 determined by the TTL value. The default TTL value 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.

What to do next

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