This topic describes how to map a custom domain name to a bucket.

Object Storage Service (OSS) allows you to map a custom domain name to an OSS bucket based on a CNAME record. You can use this method to migrate data to OSS. For example, you have the domain name, and all of your images can be accessed by using URLs in the following format: To access your images by using original URLs after you migrate the images to an OSS bucket, perform the following steps:

  • Activate OSS and create a bucket.
  • Modify the Domain Name System (DNS) configurations of the domain name. Add a CNAME record to map to an OSS endpoint such as
  • Log on to the OSS console to map to the created bucket.
  • Upload an image to the OSS bucket.

You can use the original URL to access the image that is stored in the OSS bucket. For more information about how to map custom domain names, see Map custom domain names.

To use your custom domain name as the endpoint of a bucket when you use OSS SDK for Browser.js, set the value of cname to true.

let OSS = require('ali-oss')

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

Notice If a custom domain name is mapped to a bucket, the domain name cannot be used to call the list_buckets operation.