A bucket is a container for objects stored in OSS. Every object is contained in a bucket. This topic describes how to create a bucket.

The following code provides an example on how to create a bucket:

let OSS = require('ali-oss');

let client = new OSS({
  // The endpoint of the China (Hangzhou) region is used in this example. Specify the actual endpoint.
  region: '<Your region>',
  // Security risks may arise if you use the AccessKey pair of an Alibaba Cloud account to log on to OSS because the account has permissions on all API operations. We recommend that you use your RAM user's credentials to call API operations or perform routine operations and maintenance. To create a RAM user, log on to the RAM console.
  accessKeyId: '<Your AccessKeyId>',
  accessKeySecret: '<Your AccessKeySecret>'
});

// Create a bucket.
async function putBucket() {
  try {
    const options = {
      storageClass: 'Archive', // By default, the storage class of a bucket is Standard. To set the storage class of the bucket to Archive, set the value of storageClass to Archive.
      acl: 'public-read', // By default, the ACL of a bucket is private. To set the ACL of the bucket to public read, set the value of acl to public-read.
      dataRedundancyType: 'ZRS' // By default, the data redundancy type of a bucket is locally redundant storage (LRS). To set the data redundancy type of the bucket to zone-redundant storage (ZRS), set the value of dataRedundancyType to ZRS.
    }
    const result = await client.putBucket('<Your Bucket Name>');
    console.log(result);
  } catch (err) {
    console.log(err);
  }
}

putBucket();        

For more information about how to create a bucket, see PutBucket.