Create Bucket
Updated at:2025-11-03
Create Bucket
-
Basic workflow
- Create a BosClient instance.
- To use the createBucket() method, you must provide the name of the bucket.
-
Example code
JavaScript1let newBucketName = <BucketName>; //reate a new bucket and specify the bucket name 2client.createBucket(newBucketName) 3 .then(function() { 4 // Creation completed, add your own code; 5 }) 6 .catch(function(error) { 7 // Creation failed, add your own code to handle the exception 8 });Plain Text1> **Note:** 2> 3> 1. Since bucket names are unique across all regions, ensure that the BucketName does not conflict with existing names in other regions. 4> 2. Bucket naming follows the following conventions: 5> > -It only includes lowercase letters, numbers, and hyphens (-). 6> > -It must begin with a lowercase letter or number. 7> > -The length must be between 4-63 bytes. 8> 3. The bucket created through the above code has private read-write permissions and a storage class of standard (Standard).
