The mb command is used to create a bucket.

Note The commands described in this topic apply to Linux. To use the commands in other systems, replace ./ossutil in the command with the actual executable program name. For example, you can use the help command in 32-bit Windows systems by running ossutil32.exe help.

Command syntax

./ossutil mb oss://bucketname [--acl=ACL][--storage-class sc][-c file][--redundancy-type type]

Examples

  • Create a bucket
    ./ossutil mb oss://bucket1
    Notice The bucket name must be unique. If a bucket of the specified name already exists, an error message is displayed.
  • Specify the access control list (ACL) when you create a bucket
    ./ossutil mb oss://bucket1 --acl public-read-write
    --acl: specifies the ACL for the bucket. Default value: private.
    • private
    • public-read
    • public-read-write
    For more information about ACLs, see ACL-based access control.
  • Specify the storage class when you create a bucket
    ./ossutil mb oss://bucket1 --storage-class IA
    --storage-class: specifies the default storage class for the bucket. Default value: Standard.
    • Standard
    • IA
    • Archive
    • Cold Archive

    For more information about storage classes, see Overview.

  • Create a bucket in a specified region
    ./ossutil mb oss://bucket1 -e oss-cn-beijing.aliyuncs.com
  • Create a bucket from a specified configuration file
    ./ossutil mb oss://bucket1 -c your_config_file_path
  • Create a bucket and enable zone-redundant storage (ZRS)
    ./ossutil mb oss://bucket1 --redundancy-type ZRS
    --redundancy-type: specifies the data redundancy type of the bucket. Valid values: LRS (locally redundant storage) and ZRS. Default value: LRS.
    Note ZRS is available only in the China (Shenzhen), China (Beijing), and China (Shanghai) regions. If you set this parameter to ZRS when you create a bucket, you must configure an endpoint corresponding to the region. For more information about zone-redundant storage, see Zone-redundant storage.

Common options

The following table describes the options you can add to the mb command to specify bucket attributes.
Option Description
--acl Specifies the ACL for the bucket. Default value: private. Valid values:
  • private
  • public-read
  • public-read-write
For more information about ACLs, see ACL-based access control.
--storage-class Specifies the default storage class for the bucket. Default value: Standard. Valid values:
  • Standard
  • IA
  • Archive
  • Cold Archive

For more information about storage classes, see Overview.

-c, --config-file Specifies the configuration file used to create the bucket. If this option is not specified, the default configuration file is used to create the bucket. For more information about the configuration file, see config.
-e, --endpoint Specifies the endpoint corresponding to the region where the bucket resides. If this option is not specified, the endpoint in the default configuration file is used to specify the region of the bucket.
-L, --language Specifies the language ossutil uses. Valid values: CH and EN. Default value: CH. To set this option to CH, ensure that your system supports UTF-8 encoding.
--loglevel Specifies the log level. The default value is null, which indicates that no log files are generated. Valid values:
  • info: generates prompt logs.
  • debug: generates detailed logs that contain corresponding HTTP request and response information.
--retry-times Specifies the number of times an operation is retried if the operation fails. Valid values: 1 to 500. Default value: 10.
--proxy-host Specifies the URL of the proxy server. HTTP, HTTPS, and SOCKS5 proxies are supported. Examples: http://120.79. **.**:3128 and socks5://120.79. **. **:1080.
--proxy-user Specifies the username of the proxy server. The default value is null.
--proxy-pwd Specifies the password of the proxy server. The default value is null.
--redundancy-type Specifies the data redundancy type of the bucket. Valid values: LRS and ZRS. Default value: LRS.
Note For more information about common options, see View all supported options.