All Products
Search
Document Center

Object Storage Service:Map a custom domain to an OSS-accelerated domain

Last Updated:Jan 25, 2024

If you want to use a custom domain to access a bucket that resides far from you and accelerate the access, you can map the custom domain to the bucket and then add a CNAME record to point the custom domain to the OSS-accelerated domain. For example, if you reside in the Chinese mainland and want to use a custom domain to download objects from or upload objects to a bucket that resides outside the Chines mainland, you can perform the preceding operations to accelerate data access.

Prerequisites

  • Transfer acceleration is enabled. For information about how to enable transfer acceleration and the use scenarios of transfer acceleration, see Transfer acceleration.

  • A custom domain is mapped to the bucket that you want to access. For information about how to map a custom domain to a bucket, see Map custom domain names.

Billing rules

  • When you use an acceleration endpoint to upload data, you are charged transfer acceleration fees based on the traffic that is generated.

  • When you use an acceleration endpoint to download data, you are charged transfer acceleration fees based on the traffic that is generated and the fees for outbound traffic over the Internet. For example, when you use an acceleration endpoint to download 1 GB data from a bucket for which transfer acceleration is enabled, you are charged for transfer acceleration for 1 GB data and 1 GB outbound traffic over the Internet.

    For more information, see Transfer acceleration fees and Traffic fees.

Procedure

Step 1: Add a CNAME record

  1. Log on to the Alibaba Cloud DNS console.

  2. On the Domain Name Resolution page, click DNS Settings in the Actions column of the domain that you want to manage.

  3. On the DNS Settings tab, click Add DNS Record. In the Add DNS Record panel, configure the parameters. The following table describes the parameters.

    Parameter

    Description

    Example

    Record Type

    Select CNAME.

    CNAME

    Hostname

    Specify the host record based on the prefix of the domain.

    • For a root domain, such as example.com, enter @.

    • For a subdomain, enter the prefix of the subdomain. For example, if the domain is static.example.com, enter static.

    static

    DNS Request Source

    Select a DNS line that is used to resolve the domain. We recommend that you select Default for this parameter to allow the DNS system to automatically select an optimal line.

    Default

    Record Value

    Enter an OSS-accelerated domain. You can enter an OSS-accelerated domain in which the global acceleration endpoint or the acceleration endpoint for regions outside the Chinese mainland is specified based on your business requirements. For more information about transfer acceleration endpoints, see Regions and endpoints.

    examplebucket.oss-accelerate.aliyuncs.com

    TTL Period

    Enter the update interval of the record. In this example, use the default value.

    10 Minutes

  4. Click OK.

Step 2: Verify whether the custom domain is mapped to the OSS-accelerated domain

After you map a custom domain to an OSS-accelerated domain, you can run the nslookup or dig command to check CNAME resolution. If the OSS-accelerated domain is displayed, the CNAME record that you added for the custom domain takes effect.

nslookup

Replace example.com in the following command with the custom domain that you mapped to the OSS-accelerated domain and run the command:

nslookup example.com

The following figure shows a sample success response.

Dingtalk_20231222152704.jpg

dig

Replace example.com in the following command with the custom domain that you mapped to the OSS-accelerated domain and run the command:

dig example.com

image.png

Step 3: Use the custom domain to test the transfer acceleration effect

In the following examples, ossutil is used to download objects to local paths:

  • Use the default bucket domain to test the download efficiency

    1.jpg

  • Use the custom domain that you mapped to the OSS-accelerated domain to test the download efficiency

    If you use ossutil to access OSS by using custom domains, you must configure the mapping between the buckets and the custom domains in the ossutil configuration file. For more information, see Specify a custom domain name.

    2.jpg

According to the test results, the download efficiency when you use the custom domain that you have mapped to the OSS-accelerated domain outperforms the download efficiency when you use the default bucket domain.

References

If you want to accelerate access when you use custom domains to access static hot objects in OSS or when your website or application is experiencing high concurrency, you can map custom domains to CDN-accelerated domains. For more information, see Map accelerated domain names.