Create a bucket

Updated at:

Creates an OSS bucket with optional ACL, storage class, and data redundancy settings.

Usage notes

  • An Alibaba Cloud account can create a maximum of 100 buckets in each region.

  • Each region has a corresponding endpoint. For more information about the endpoints for each region, see Endpoints.

  • Starting at 10:00:00 (UTC+8) on October 13, 2025, OSS gradually enables Block public access by default for buckets that are created by calling API operations or by using OSS SDKs or ossutil in all regions. For the time when the change takes effect in each region, see Announcement. After this feature is enabled, you cannot grant public access permissions, including the public-read or public-read-write ACL and bucket policies that allow public access. If your business requires public access, you can disable block public access after the bucket is created.

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 policies or Bucket Policy.

API

Action

Description

PutBucket

oss:PutBucket

Creates a bucket.

oss:PutBucketAcl

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

Command syntax

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

Parameter

Type

Description

--acl

string

The bucket ACL.

--bucket

string

The name of the bucket.

--create-bucket-configuration

string

The bucket configuration in XML or JSON format.

--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

This parameter accepts XML or JSON:

  • 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 examplebucket with private ACL, resource group rg-123, Standard storage class, and LRS redundancy.

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

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

      Command:

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

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

      Command:

      ossutil api put-bucket --bucket examplebucket --acl private --resource-group-id rg-123 --create-bucket-configuration file://create-bucket-configuration.json
    • Inline JSON parameters

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