This topic describes how to bind a custom domain name to a bucket and add a CNAME record.

Prerequisites

A bucket is created. For more information about how to create a bucket, see Create buckets.

For more information about how to bind a custom domain name, see Bind a custom domain name in OSS Developer Guide.

Procedure

  1. Log on to the OSS console.
  2. Click Buckets, and then click the name of the target bucket.
  3. Choose Transmission > Domain Names.
  4. Click Bind Custom Domain Name. In the Bind Custom Domain Name dialog box that appears, set the following parameters.
    • Custom Domain Name: Enter the domain name that you want to bind, such as hello-world.com. The domain name can be a maximum of 63 characters in length.
    • Add CNAME Record Automatically: You can automatically add a CNAME record managed by your Alibaba Cloud account. To add a record of a domain name that is not managed by your Alibaba Cloud account, you must manually configure the DNS of your DNS provider. For more information, see Manually add a CNAME record.
    Notice
    • If a domain name conflict message appears, the domain name is already bound to another bucket. To resolve this issue, you can use either one of the following methods:
      • Use another domain name.
      • Verify the ownership of the domain name and forcibly bind the domain name to your bucket. This operation unbinds the domain name from the previous bucket. For more information, see Verify the ownership of a domain name.
    • If you select Add CNAME Record Automatically and a CNAME record has already been added for the domain name that you bind to the bucket, the original CNAME record is overwritten.
  5. Click Submit.
    Note To unbind a custom domain name from the bucket, click the Domain Names tab. Click Manage Binding Configurations in the Actions column corresponding to a custom domain name. In the Manage Binding Configurations dialog box that appears, click Unbind.

Manually add a CNAME record

Skip this step if a CNAME record is automatically added.

You must add a CNAME record to DNS of your DNS provider. In this topic, Alibaba Cloud DNS is used as an example to describe the process of adding a CNAME record.

  1. Log on to the Alibaba Cloud DNS console.
  2. On the Manage DNS page that appears, click Configure in the Actions column corresponding to the target domain name.
  3. On the DNS Settings page that appears, click Add Record. In the Add Record dialog box that appears, configure parameters listed in the following table.
    Parameter Description
    Type Select the type of the record to direct requests.

    In this example, select CNAME.

    Host Enter the host record based on the prefix of the domain name. Examples:
    • If the domain name is www.aliyun.com, enter www.
    • If the domain name is aliyun.com, enter @.
    • If the domain name is abc.aliyun.com, enter abc.
    • If the domain is a second-level domain such as a.aliyun.com or b.aliyun.com, enter an asterisk (*).
    ISP Line Select the ISP line used to resolve the domain name.

    We recommend that you select Default to allow the system to select the optimal line.

    Value Enter the value of the record based on the selected record type.

    In this example, enter the public endpoint of the bucket.

    TTL Select the update period of the record. In this example, select the default value.
  4. Click OK.
    Note A new CNAME record takes effect immediately. A modified CNAME record requires up to 72 hours to take effect.

Verify CNAME status

After a CNAME record is configured, the period required for the record to take effect varies with different DNS providers. You can run the ping or lookup command to check the status of an added CNAME. If the request is redirected to *.oss-cn-*.aliyuncs.com, the CNAME is in effect.

Verify the ownership of a domain name

If your domain name is bound to a bucket owned by another user, you can perform the following steps to verify the ownership of the domain name and forcibly unbind the domain name from the current bucket.
Note The following steps apply only to scenarios where a domain name conflict message appears when you bind a custom domain name.
  1. Click Obtain TXT to obtain a TXT record generated by the system based on your information.
  2. Add a CNAME record to the DNS of your DNS provider. For a domain name added to Alibaba Cloud DNS, you can add a record in the Add Record dialog box following the procedures described in Manually add a CNAME record. Then, you can configure the parameters as follows:
    • Type: Select TXT.
    • Host: Enter the host generated in step 1.
    • Value: Enter the value generated in step 1.
    • Use the default values for other parameters.
  3. In the Bind Custom Domain Name dialog box, select I have added the TXT record. Continue submission. If the system checks that the information is correct, the verification is passed.

References