You can use Content Delivery Network (CDN) to accelerate the delivery of static resources from an Object Storage Service (OSS) bucket. This topic describes the scenario where CDN integrates with OSS and how to configure the acceleration in the CDN console.


Background information

Alibaba Cloud CDN works with a precise scheduling system. The system redirects requests for static resources to the edge nodes closest to the end users who make the requests. This mechanism enables efficient retrieval of required resources, and minimizes network congestion.

Static resources stored in an OSS bucket include static scripts, images, attachments, audio files, and video files. CDN nodes cache static resources from the OSS bucket. When a client requests the cached static resources, the scheduling system redirects the request to the edge node closest to the client. Then, this edge node returns the cached resources to the client. The following figure shows the architecture of integrating CDN with an OSS bucket.Scenario
This architecture provides the following benefits:
  • All requests to the origin server are sent to CDN nodes. This reduces the pressure on the origin server.
  • Compared with the resources returned by the OSS bucket, the resources returned by CDN nodes incur a lower outbound data transfer fee.
  • The client retrieves static resources from the closest CDN node. This minimizes the network transmission distance and ensures the quality of retrieved resources.

The following section describes how to add a Canonical Name (CNAME) record in the Alibaba Cloud Domain Name System (DNS) console.


  1. In the CDN console, use the custom domain associated with the OSS bucket to add a CDN domain.
    1. Log on to the CDN console.
    2. In the left-side navigation pane, click Domain Names.
    3. On the Domain Names page, click Add Domain Name.
    4. Select OSS Domain in the Origin Info section, and complete other required settings. The following table describes the parameters for adding the CDN domain.
      Parameter Option Description
      Domain Name to Accelerate N/A
      Enter a domain name, for example, Follow these rules:
      • You can use a subdomain name or a wildcard domain name as the accelerated domain name, for example,
      • Wildcard domains are supported and Chinese domains are not supported. Follow the instructions to enter a wildcard domain name, for example, * For more information about how to add a wildcard domain name, see Rules for adding wildcard domain names.
      • You cannot add a domain name to Alibaba Cloud CDN more than once. If a DomainAlreadyExist error occurs, submit a ticket.
      • Up to 50 domains can be added to Alibaba Cloud CDN under each account. To add more domains, submit a ticket.
      • Content that is served from the domain must comply with the limits of Alibaba Cloud CDN. For more information, see Limits.
      Business Type Image and Small File If you want to accelerate the delivery of small-sized static content on your website, such as small files, images, and style sheets, we recommend that you select Image and Small File from the Business Type drop-down list.
      Large File Download If you want to accelerate the delivery of static files that are larger than 20 MB, such as game installation packages, app updates, mobile read-only memory (ROM) upgrades, and app package downloads, we recommend that you select Large File Download from the Business Type drop-down list.
      VOD If you want to accelerate the delivery of on-demand video or audio content, we recommend that you select VOD from the Business Type drop-down list.
      DCDN If your website or application contains large amounts of dynamic content, you can select DCDN from the Business Type drop-down list. With simple configurations, Dynamic Route for CDN (DCDN) can accelerate the delivery of dynamic and static content separately. Static content is cached and dynamic content is retrieved from the origin based on the optimal link algorithm and protocol layer optimization of Alibaba Cloud.

      After you select DCDN, you are prompted to go to the Dynamic Route for CDN console. You can then create and configure the accelerated domain. For more information.

      Origin Info IP You can specify the public IP addresses of one or more servers. IP addresses of Alibaba Cloud Elastic Compute Service (ECS) instances are exempt from manual review.
      Site Domain You can specify the domain names of one or more publicly accessible origin servers.
      Note The domain name of the origin server cannot be the same as the accelerated domain name. Otherwise, a DNS resolution loop occurs, and the requests cannot be forwarded to the origin server correctly. For example, if you set the accelerated domain name to, you can set the origin domain name to
      OSS Domain You can manually enter the Internet domain name of an Alibaba Cloud Object Storage Service (OSS) bucket, for example, To view the Internet domain name of an OSS bucket, go to the OSS console. You can also directly select an OSS bucket under the same account.
      Function Compute Domain You must set the Region and Domain Name parameters of the Function Compute domain. For more information, see Set a Function Compute domain name.
      Port N/A
      Select a port as needed.
      • Port 80

        Specifies access to resources over HTTP.

      • Port 443

        Specifies access to resources over HTTPS.

      Region Outside Mainland China If you select Outside Mainland China, no Internet content provider (ICP) filing is required.
      Global If you select Global, you must apply for an ICP filing with the Ministry of Industry and Information Technology (MIIT) of China. For more information, see Domain filing.
      Mainland China If you select Mainland China, you must apply for an ICP filing with the MITT of China. For more information, see Domain filing.
    5. Click Next.
      After your CDN domain is reviewed and approved, you can view the domain name on the Domain Names page in the CDN console. The added domain is displayed in the Enabled state.domain complete
  2. Log on to the CDN console and obtain the CNAME of the CDN domain.
    1. In the left-side navigation pane, click Domain Names.
    2. On the Domain Names page, copy the CNAME domain of your accelerated domain.
      Domain names
  3. In the Alibaba Cloud DNS console, add a CNAME record.
    1. Log on to the Alibaba Cloud DNS console.
    2. On the Manage DNS page, click the Domains tab, select a domain, and then click Configure in the Actions column for the domain.
      DNS Settings
    3. Click Add Record to add a CNAME record.
      • Type: Select CNAME from the drop-down list.
      • Host: Enter the prefix of the accelerated domain.
        Accelerated domain Host testcdn www @
        * *
      • ISP Line: Use the default value.
      • Value: Enter the CNAME domain that you have copied in step 1.
      • TTL: Use the default value.
    4. Click OK.
      The CNAME record is added. Immediately after you add the record on Alibaba Cloud DNS, the CNAME record takes effect, and the CDN service is automatically enabled.
      • If you modify the CNAME record, the record takes effect within 72 hours after the modification.
      • After you add a CNAME record, it takes approximately 10 minutes to update the status in the console. The message "You must add the CNAME record" may still appear on the Domain Names page. Ignore this message.
  4. On a local computer, check whether the CNAME record works as expected.
  5. In the OSS console, turn on Auto CDN Cache Update for the CDN domain.

    With Auto CDN Cache Update enabled, OSS refreshes an updated object on the corresponding CDN node immediately after the update is completed in the specified bucket. In this way, the CDN node can cache the latest object from OSS.

    After you unbind the CDN domain from the specified bucket, OSS does not automatically refresh the objects cached on the CDN node. However, you can configure the refresh and preload features in the CDN console. For more information, see Configure the refresh and prefetch features.

    1. Log on to the OSS console.
    2. In the left-side navigation pane, select a target bucket under Buckets.
    3. You are navigated to the Overview tab. Click the Domain Names tab.
    4. On the Domain Names tab, turn on Auto CDN Cache Update for the CDN domain.
      Auto CDN cache update

Subsequent operations

After the CNAME record takes effect, if an end user requests OSS resources by including only the CDN domain in the request, an AccessDenied error occurs. In this case, the end user can use one of the following methods to retrieve the resources:
  • To request OSS resources on a Web page, include the CDN domain followed by the target file path in the request. For example, if the CDN domain is and the target file 123.jpg is located in the root directory, the URL for requesting the target file is
  • To request OSS resources by using a client, specify the CDN domain as the OSS bucket domain, and use the CDN domain to connect to the bucket.