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 run the mb command to create buckets.
Command syntax
./ossutil64 mb oss://bucketname [--acl <value>][--storage-class <value>][--redundancy-type <value>]
The following table describes the parameters that you can configure when you run this command.
Parameter | Description |
---|---|
bucketname | The name of the bucket that you want to create. A bucket name must be globally unique within Object Storage Service (OSS). The name of a bucket cannot be changed after the bucket is created. |
--acl | The access control list (ACL) of the bucket. Default value: private. Valid values:
|
--storage-class | The storage class of the bucket. Default value: Standard. Valid values:
For more information about storage classes, see Overview. |
--redundancy-type | The redundancy type of the bucket. Valid values:
Notice ZRS is supported in the following regions: China (Shenzhen), China (Beijing), China
(Hangzhou), China (Shanghai), China (Hong Kong), and Singapore.
|
Examples
- You can run the following command to create a bucket named examplebucket:
./ossutil64 mb oss://examplebucket
If you do not specify the region in which you want to create the bucket, the bucket is created in the region specified by the endpoint in the ossutil configuration file. For example, if the endpoint specified in the configuration file is
https://oss-cn-hangzhou.aliyuncs.com
, the bucket is created in the China (Hangzhou) region. - You can run the following command to create a bucket named examplebucket and set the
bucket ACL to private, storage class to IA, and redundancy type to ZRS.
./ossutil64 mb oss://examplebucket --acl private --storage-class IA --redundancy-type ZRS
- If a similar output is displayed, the specified bucket is created.
0.335189(s) elapsed
Common options
If you use ossutil to switch to a bucket that is located in a different region, you can use the -e option to specify the endpoint of the region in which the specified bucket resides. If you use ossutil to switch to a bucket that belongs to another Alibaba Cloud account, you can use the -i option to specify the AccessKey ID of the specified account, and use the -k option to specify the AccessKey secret of the specified account.
./ossutil64 mb oss://examplebucket -e oss-cn-shanghai.aliyuncs.com -i LTAI4Fw2NbDUCV8zYUzA**** -k 67DLVBkH7EamOjy2W5RVAHUY9H****
For more information the mb command, see Common options.