Buckets are containers for objects in OSS. Run the mb command to create a bucket before uploading objects.
Usage notes
-
To create a bucket, you must have the oss:PutBucket permission. For more information, see Grant a custom policy.
-
ossutil 1.6.16 and later use ossutil as the binary name across all operating systems. Earlier versions require OS-specific binary names. For more information, see ossutil command reference.
-
Starting October 13, 2025, at 10:00 (UTC+8), OSS begins a phased rollout to enable blocking public access by default for all new buckets. This change applies to buckets created through the API, SDKs, and ossutil. For the specific rollout schedule in each region, see the Notice. When this feature is enabled, you cannot grant public access to the bucket, either through ACLs (such as public-read or public-read-write) or bucket policies. If your use case requires public access, disable this setting after the bucket is created.
-
Take note of the following items when you run the command in OSS on CloudBox:
-
Replace the endpoints in the configuration file with the endpoints of CloudBox. For more information, see CloudBox endpoints.
-
Add --sign-version, --region, and --cloudbox-id options to the sample command in this topic. For more information about the options, see Common options.
Create a bucket with command options
Command syntax
ossutil mb oss://bucketname
[--acl <value>]
[--storage-class <value>]
[--redundancy-type <value>]
Parameters and options:
|
Parameter/Option
|
Description
|
|
bucketname
|
The bucket name. Must be globally unique in OSS and cannot be changed after creation.
|
|
--acl
|
The bucket ACL. Valid values:
-
private (default): Only the bucket owner can read and write objects. Other users have no access.
-
public-read: Only the bucket owner can write objects. All users, including anonymous users, can read objects. This may cause unauthorized access and unexpected fees. Use with caution.
-
public-read-write: All users, including anonymous users, can read and write objects. This may cause unauthorized access, unexpected fees, and legal risks from prohibited uploads. Do not use unless necessary.
|
|
--storage-class
|
The bucket storage class. Valid values:
-
Standard (default): For frequently accessed data.
-
IA: Infrequent Access. For data accessed once or twice a month. Minimum storage period: 30 days. Minimum billable size: 64 KB. Supports real-time access. Data retrieval fees apply.
-
Archive: For long-term storage. Minimum storage period: 60 days. Minimum billable size: 64 KB. Requires restoration before access (approximately 1 minute). Data retrieval fees apply.
-
ColdArchive: For long-term storage of rarely accessed data. Minimum storage period: 180 days. Minimum billable size: 64 KB. Requires restoration before access. Restoration time varies by object size and mode. Data retrieval fees apply.
Note
If you use OSS on CloudBox, only the Standard storage class is supported.
For more information about storage classes, see Storage classes.
|
|
--redundancy-type
|
The bucket redundancy type. Valid values:
-
LRS (default): Locally redundant storage. Stores copies across devices within the same zone, ensuring data reliability even if two devices fail simultaneously.
-
ZRS: Zone-redundant storage. Stores data copies across multiple zones in the same region. Data remains accessible even if a zone becomes unavailable.
Important
-
ZRS is available in: China (Shenzhen), China (Beijing), China (Hangzhou), China (Shanghai), China (Hong Kong), Singapore, and Indonesia (Jakarta). ZRS increases storage costs and cannot be disabled after enablement.
-
If you use OSS on CloudBox, this parameter is not supported.
|
Examples
-
Create a bucket named examplebucket:
ossutil mb oss://examplebucket
If no region is specified, the bucket is created in the region mapped to the endpoint in your ossutil configuration file. For example, if the endpoint is https://oss-cn-hangzhou.aliyuncs.com, the bucket is created in the China (Hangzhou) region.
-
Create a bucket named examplebucket with ACL set to private, storage class to IA, and redundancy type to ZRS:
ossutil mb oss://examplebucket --acl private --storage-class IA --redundancy-type ZRS
-
If the following output is returned, the bucket was created successfully:
0.335189(s) elapsed
Create a bucket from an XML file
Command syntax
ossutil mb oss://bucketname local_xml_file
Parameters:
|
Parameter
|
Description
|
|
bucketname
|
The bucket name.
|
|
local_xml_file
|
Path to a local XML file with bucket configurations. Example: localfile.xml.
|
Examples
-
Define bucket configurations in the localfile.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration>
<StorageClass>IA</StorageClass>
<DataRedundancyType>LRS</DataRedundancyType>
</CreateBucketConfiguration>
-
Create a bucket using the local XML configuration file:
ossutil mb oss://examplebucket localfile.xml
Common options
To access a bucket in a different region, use -e to specify the endpoint. To access a bucket owned by a different Alibaba Cloud account, use -i for the AccessKey ID and -k for the AccessKey secret.
For example, create a bucket named examplebucket in the China (Shanghai) region under a different Alibaba Cloud account:
ossutil mb oss://examplebucket -e oss-cn-shanghai.aliyuncs.com -i yourAccessKeyID -k yourAccessKeySecret
Common options.