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, see Create buckets.

For more information about how to bind a custom domain name, see Bind custom domain names 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, configure 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: The CNAME record can be automatically added if the domain name is 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 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 turn on 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.

Manually add a CNAME record

Skip this step if a CNAME record is automatically added.

You must add a CNAME record to the 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, click Configure in the Actions column corresponding to the target domain name.
  3. On the DNS Settings page, click Add Record. In the Add Record dialog box, configure parameters listed in the following table.
    Parameter Description
    Type Select the type of the record.

    In this example, select CNAME.

    Host Enter the host record based on the prefix of the domain name.
    • To add a top-level domain such as aliyun.com, enter @.
    • To add a second-level domain, enter the prefix of the second-level domain name. Example: If the domain is abc.aliyun.com, enter abc.
    • If all second-level domains match the public endpoints of the bucket, enter *.
    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 interval of the record. In this example, select the default value.
  4. Click OK.
    Note A new CNAME record takes effect immediately. It takes up to 72 hours for the modified CNAME record 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. If a domain name is added to Alibaba Cloud DNS, you can configure the following parameters in the Add Record dialog box:
    • 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.

Unbind a domain name

You can unbind a custom domain name from the bucket when you no longer use it.

  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. On the Domain Names page, click Manage Binding Configurations in the Actions column corresponding to the target domain name.
  5. In the Manage Binding Configurations dialog box, click Unbind. Click OK.

References