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 recordsAn 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.
- CNAME recordsA 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.
An ALB instance is created. For more information, see Create an ALB instance.
Configure a CNAME record
- Log on to the ALB console.
- In the top navigation bar, select the region where the ALB instance is deployed.
- Find the ALB instance that you want to manage and copy the domain name.
- To create a CNAME record, perform the following operations:
- Log on to the Alibaba Cloud DNS console.
- On the Manage DNS page, click Add Domain Name.
- 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.
- In the Actions column of the domain name that you want to manage, click Configure.
- On the DNS Settings page, click Add Record.
- 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,
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.