You can use OSS and Alibaba Cloud Content Delivery Network (CDN) together to accelerate downloads of static objects. These static objects are frequently downloaded by a large number of users in the same region at the same time. You can configure your OSS bucket as the origin and use CDN to publish the data in the bucket to edge nodes. When a large number of end users must access an object in your bucket repeatedly, they can obtain the object cached on edge nodes to improve the response speed.

In traditional web architectures, static data and dynamic data are both stored in ECS instances and are accessed in the same way. These architectures limit system performance as the access to the system increases. The following figure shows the traditional web architecture.

By using OSS and CDN, you can separate static data from dynamic data to establish a flexible web architecture that supports bursts of access from multiple users. The following figure shows the web architecture that uses OSS and CDN.


  • Static objects are accessed by a large number of users, which results in high server loads and I/O bottlenecks that decrease the access speed.
  • The number of static objects is too large to store in ECS instances.
  • Users that need to access static objects are distributed in different regions. The same static object needs to be repeatedly downloaded by users from a region.


OSS is used to store a large number of objects, including static images, videos, downloaded packages, and application update packages. CDN uses OSS as the origin and delivers objects cached on the edge nodes closest to users. This architecture has the following advantages:

  • All static objects are accessed through CDN. Therefore, the loads of web servers are reduced.
  • The storage cost is minimized because the price of OSS storage is only half that of ECS disks.
  • OSS allows you to store large amounts of data in the cloud. You do not need to upgrade the storage architecture.

Use case

This section uses a website as an example Assume that website is created to share information about automobiles. The website is built on PHP and stores 10 GB of images and some JavaScript files. An ECS instance is purchased to store all codes and install the MySQL database. The increasing visits result in longer time to access the website, load images, and obtain responses from the website. The engineers of the website find that users upload an increasingly large number of images to the website, which are almost over 1 TB in size.

In this case, the website owner can use OSS and CDN to optimize the website architecture. This way, the storage and access of static data are separated from those of the dynamic data, which improves user experience while ensuring cost-effectiveness.

To implement the solution, perform the following steps:
  1. Classify the website code and store the dynamic code and static data in different directories.
    • Create a directory named Images to store all high-definition images.
    • Create a directory named Javascript to store all JavaScript scripts.
    • Create a directory named Attachment to store all images and attachments uploaded by users.
  2. Create an OSS bucket.

    Create an OSS bucket in the region where the ECS instance is located. Set the ACL of the bucket to public read and ensure that the bucket name corresponds to the directory created on the ECS instance. Example: acar-image-bucket. For more information about how to create a bucket, see Create buckets.

  3. Bind accelerated domain name to the bucket. For more information about how to bind an accelerated domain name, see Bind accelerated domain names.
  4. Upload objects and verify the acceleration result.
    1. Upload all image objects from the Image directory in the ECS instance to the acar-image-bucket bucket. For more information about how to upload files, see Upload objects.
    2. Query the URLs of the uploaded objects. The URLs are in the following format: accelerated domain name/object path. For more information, see How to obtain the URL of an uploaded object.
  5. Follow the preceding steps to create two buckets named acar-js-bucket and acar-csimages-bucket. Bind accelerated domain names to the buckets, upload objects from the Javascript directory to acar-js-bucket, and upload objects in the Attachment directory to acar-csimages-bucket.
  6. In the code stored in the ECS instance, replace the URLs used to access static objects with the accelerated domain names bound to the buckets. This way, the static objects of the website are stored in OSS and accessed through CDN accelerated domain names, saving the storage and bandwidth resources of the ECS instance.
    Note If you want to use code to synchronize objects uploaded by users to acar-csimages-bucket automatically, see the documentations of the PutObject API operation.

Auto CDN cache update

If you use CDN and bind an accelerated domain name to your OSS bucket, you can use the auto CDN cache update feature. After you enable this feature, OSS automatically updates the objects cached on CDN edge nodes when the objects are modified in OSS. You do not need to call API operations to manually update the CDN cache.

For example, if you bind an accelerated domain name to your bucket and overwrite an object named test.jpg by uploading an object with the same name, OSS updates the object cached on the CDN edge nodes, which can be accessed through In general, an object cached on CDN edge nodes is updated within 10 minutes after the object is modified in OSS. The time depends on the update period guaranteed by CDN.

For more information about how to enable the auto CDN cache update feature, see Step 3: Enable auto CDN cache update.