All Products
Search
Document Center

Object Storage Service:Create a bucket

Last Updated:Apr 30, 2025

Creates a bucket.

Usage notes

  • You can create up to 100 buckets in the same region by using an Alibaba Cloud account.

  • Each region can be accessed by using the corresponding endpoints. For more information, see Regions and endpoints

  • From 10:00 (UTC+8) on October 13, 2025, OSS will implement a phased adjustment across all regions to enable Block Public Access by default for new buckets created using the API, OSS SDKs, or ossutil. For details about the exact times when the adjustment will take effect in each region, see [Official Announcement] Adjustment to Public Access Blocking Configurations for Newly Created Buckets. Once Block Public Access is enabled, you cannot configure public access permissions, including public ACLs (public read and public read/write) and bucket policies that allows public access. You can disable this feature after the bucket is created if your business requires public access.

Permissions

By default, an Alibaba Cloud account has full permissions. RAM users or RAM roles under an Alibaba Cloud account do not have any permissions by default. The Alibaba Cloud account or account administrator must grant operation permissions through RAM Policy or Bucket Policy.

API

Action

Description

PutBucket

oss:PutBucket

Make sure that buckets are created.

oss:PutBucketAcl

After creating a bucket, this permission is required to modify the ACL of the bucket.

Command syntax

ossutil api put-bucket --bucket value [flags]

Parameter

Type

Description

--acl

string

The access control list (ACL) of the bucket.

--bucket

string

The name of the bucket.

--create-bucket-configuration

string

The container that stores the information about the bucket.

--resource-group-id

string

The ID of the resource group.

Note

The put-bucket command provides access to the PutBucket operation. For more information about the API operation, see PutBucket.

--create-bucket-configuration

The --create-bucket-configuration parameter supports configuration options in the XML and JSON formats:

  • XML format:

    <?xml version="1.0" encoding="UTF-8"?>
    <CreateBucketConfiguration>
      <StorageClass>Standard</StorageClass>
      <DataRedundancyType>LRS</DataRedundancyType>
    </CreateBucketConfiguration>
  • JSON format:

    {
      "StorageClass": "Standard",
      "DataRedundancyType": "LRS"
    }
Note

For more information, see Command-line options.

Examples

  • Create a bucket named examplebucket.

    ossutil api put-bucket --bucket examplebucket
  • Create a bucket named examplebucket and set its ACL to private, resource group to rg-123, storage class to Standard, and redundancy type to locally redundant storage (LRS).

    • Use an XML configuration file (create-bucket-configuration.xml)

      <?xml version="1.0" encoding="UTF-8"?>
      <CreateBucketConfiguration>
        <StorageClass>Standard</StorageClass>
        <DataRedundancyType>LRS</DataRedundancyType>
      </CreateBucketConfiguration>

      Sample command:

      ossutil api put-bucket --bucket examplebucket --acl private --resource-group-id rg-123 --create-bucket-configuration file://create-bucket-configuration.xml
    • Use a JSON configuration file (create-bucket-configuration.json)

      {
        "StorageClass": "Standard",
        "DataRedundancyType": "LRS"
      }

      Sample command:

      ossutil api put-bucket --bucket examplebucket --acl private --resource-group-id rg-123 --create-bucket-configuration file://create-bucket-configuration.json
    • Use JSON parameters in the command line

      ossutil api put-bucket --bucket examplebucket --acl private --resource-group-id rg-123 --create-bucket-configuration "{\"StorageClass\":\"Standard\",\"DataRedundancyType\":\"LRS\"}"