Updated on 2025-08-22 GMT+08:00

Creating a Bucket

Function

You can use this command to create a bucket. A bucket name must be unique in OBS. One account can create a maximum of 100 buckets.

If you create a bucket and name it the same as an existing one in the same account and region, no error will be reported and status code 200 is returned. The bucket properties comply with those set in the first creation request. In other cases, creating a bucket with the same name as an existing one will receive the status code 409, indicating that the bucket already exists.

If the configured endpoint is a global domain name, you may need to wait several minutes before uploading objects to the created bucket. Therefore, set the endpoint to a regional domain name according to Initializing the Configuration if you want to upload objects instantly to the bucket.

Command Line Structure

  • In Windows
    obsutil mb obs://bucket [-fs] [-az=xxx] [-acl=xxx] [-sc=xxx] [-location=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]
  • In Linux or macOS
    ./obsutil mb obs://bucket [-fs] [-az=xxx] [-acl=xxx] [-sc=xxx] [-location=xxx] [-config=xxx] [-e=xxx] [-i=xxx] [-k=xxx] [-t=xxx]

Examples

  • Take the Windows OS as an example. Run the obsutil mb obs://bucket-test command to create a bucket. The creation is successful.
    obsutil mb obs://bucket-test
    Start at 2024-09-29 07:52:11.3769487 +0000 UTC
    
    Create bucket [bucket-test] successfully, request id [000001923CC401864018BA75753D2D5F]
    
  • Take the Windows OS as an example. Run the obsutil mb obs://bucket001 command to create a bucket with the same name as the bucket of another account. The creation fails.
    obsutil mb obs://bucket001
    Start at 2024-09-30 07:03:50.1378331 +0000 UTC
    
    Create bucket [bucket001] failed, status [409], error code [BucketAlreadyExists], error message [The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.], request id [0000019241BE18DB4019EDD66E135C56]

Parameter Description

Parameter

Optional or Mandatory

Description

bucket

Mandatory

The bucket name

A bucket name must comply with the following rules:
  • Contains 3 to 63 characters, including lowercase letters, digits, hyphens (-), and periods (.), and starts with a digit or letter.
  • Cannot be an IP address.
  • Cannot start or end with a hyphen (-) or period (.).
  • Cannot contain two consecutive periods (.), for example, my..bucket.
  • Cannot contain periods (.) and hyphens (-) adjacent to each other, for example, my-.bucket or my.-bucket.

fs

Optional (additional parameter)

Creates a parallel file system.

az

Optional (additional parameter)

The data redundancy policy that can be specified for a bucket to store data in a single AZ or multiple AZs in the same region

The value is multi-az.

If multi-az is used, a bucket with multi-AZ storage will be created. If this parameter is not included, a bucket with single-AZ storage will be created.

acl

Optional (additional parameter)

The access control policy that can be specified when creating a bucket

Possible values are:

  • private: Only users granted permissions by the bucket ACL can access the bucket.
  • public-read: Anyone can read objects in the bucket.
  • public-read-write: Anyone can read, write, or delete objects in the bucket.

sc

Optional (additional parameter)

The storage class of the bucket

Different storage classes meet customers' needs for storage performance and costs.

Possible values are:

  • standard: Standard storage class. It features low access latency and high throughput, and is applicable to storing frequently accessed data (multiple accesses per month) or data that is smaller than 1 MB.
  • warm: Infrequent Access storage class. It is ideal for storing infrequently accessed (less than 12 times a year) data, but when needed, the access has to be fast.
  • cold: Archive storage class. It provides secure, durable, and inexpensive storage for rarely-accessed (once a year) data.

location

Mandatory unless the requested OBS region is the default one (additional parameter)

The region where the bucket resides

To view the currently valid regions, see Regions and Endpoints.

  • Once the bucket is created, its region cannot be changed.
  • For lower latency and faster access, select the region nearest to where the data will be accessed.
  • Most OBS features are available in all regions, but some are only available for certain regions. If you want to use some features in your bucket, you are advised to create the bucket in a region where these features are available. For details, see Function Overview.
  • If you want your bucket to be accessed from an ECS over the intranet, ensure that the bucket and the ECS are in the same region. For details, see Accessing OBS from an ECS over the Intranet.
NOTE:

This parameter indicates the region where a bucket will be created. It is mandatory only when the endpoint belongs to any other regions than the default one CN North-Beijing1 (cn-north-1).

config

Optional (additional parameter)

The user-defined configuration file for executing the current command

To learn the parameters that can be configured in this file, see Configuration Parameters.

e

Optional (additional parameter)

The endpoint

i

Optional (additional parameter)

The user's AK

k

Optional (additional parameter)

The user's SK

t

Optional (additional parameter)

The user's security token