A bucket is a container for objects stored in OSS. You must create a bucket before you upload an object to OSS. This topic describes how to create a bucket by using the mb command.
Each sample command line in this topic is based on the 64-bit Linux system. For other systems, replace ./ossutil64 of the command with the corresponding binary name. For example, for the 64-bit Windows system, replace ./ossutil64 with ossutil64.exe. The following table lists the binary names corresponding to each system.
./ossutil64 mb oss://bucket_name [--acl <value>][--storage-class <value>][--redundancy-type <value>]
The following table describes the parameters you can configure in the command.
|bucket_name||The name of the bucket that you want to create. A bucket name must be globally unique within OSS. Bucket names cannot be changed after the buckets are created.|
|--acl||The access control list (ACL) for a bucket. Default value: private. Valid values:
|--storage-class||The bucket storage class. Default value: Standard. Valid values:
For more information about storage classes, see Overview.
|--redundancy-type||The type of disaster recovery for a bucket. Default value: LRS. Valid values:
Notice ZRS is supported in the following regions: China (Shenzhen), China (Beijing), China (Hangzhou), China (Shanghai), China (Hong Kong), and Singapore.
- Create a bucket named examplebucket.
./ossutil64 mb oss://examplebucket
If the region where the bucket is to be located is not specified when you create a bucket, the bucket is created in the region to which the endpoint in the ossutil configuration file points . For example, if the endpoint in the configuration file is
https://oss-cn-hangzhou.aliyuncs.com, a bucket is created in the China (Hangzhou) region.
- Create a bucket named examplebucket, and specify that the ACL is private, the storage
class is Infrequent Access (IA), and the data recovery type is ZRS.
./ossutil64 mb oss://examplebucket --acl private --storage-class IA --redundancy-type ZRS
- The following result indicates that the bucket that meets the specified conditions
To use command-line tool ossutil to manage buckets that reside in different regions, you can use the -e option to switch to the endpoint of the specified bucket. To use command-line tool ossutil to manage buckets that belong to multiple Alibaba Cloud accounts, you can use the -i option to switch to the AccessKey ID of the specified account, and use the -k option to switch to the AccessKey secret of the specified account.
./ossutil64 mb oss://examplebucket -e oss-cn-shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA**** -k 67DLVBkH7EamOjy2W5RVAHUY9H****
For more information about other common options, see Common options.