This topic describes how to bind a custom domain name.

OSS supports binding custom domain names to OSS to seamlessly migrate data storage to the OSS. For example, your domain name is, and all your previous image resources are in a format similar to After you migrate the image storage to OSS, you can still access the images with the original address by binding your custom domain name to OSS:

  • Activate OSS and create a bucket.
  • Modify the DNS configuration, add a CNAME record, and direct to an endpoint of OSS (for example,
  • On OSS console, bind to the created bucket.
  • Upload images to the created bucket in OSS.

Follow the preceding steps to use the original address to access images on OSS. For more information, see Bind custom domain names (CNAME).

SDK supports the use of a CNAME as the endpoint. To do this, set the :cname parameter to true. For example:

let OSS = require('ali-oss')

let client = new OSS({
  endpoint: '<Your endpoint>'
  accessKeyId: '<Your AccessKeyId>',
  accessKeySecret: '<Your AccessKeySecret>',
  cname: true

Notice The list_buckets interface is unavailable when CNAME is used because the custom domain name is bound already to a specific bucket.