PUT Bucket

You can send the PUT Bucket request to create a bucket with the specified name.

NOTE:

You can create a maximum of 100 buckets.

The name of a bucket must be unique in OBS. If a user repeatedly creates namesake buckets in the same region, a 200 code (meaning success) is returned. If namesake buckets are repeatedly created in other cases, a 409 code (meaning existence) is returned. You can set the ACL of a bucket by adding optional header x-amz-acl to a request.

Note the following when creating buckets:

After users delete a bucket, they must wait 30 minutes before being allowed to create a namesake bucket in another region.

Storage Classes

Users are allowed to create buckets of different storage classes. The x-default-storage-class header in a bucket creation request specifies the default storage class for a bucket. The storage class of the objects in a bucket is the same as that of the bucket. There are three storage classes: STANDARD (OBS Standard), STANDARD_IA (OBS Infrequent Access), and GLACIER (OBS Archive). If this header is not in the request, the storage class of the bucket created is OBS Standard.

  • OBS Standard features low access latency and high throughput. It is applicable to storing a large number of frequently accessed hot files. The application scenarios include big data, mobile applications, hots videos, and social media images.
  • OBS Infrequent Access is applicable to storing semi-frequently accessed (less than once a month) data that requires quick response. The application scenarios include file synchronization, file sharing, and enterprise-level backup. It provides the same durability, access latency, and throughput as OBS Standard but at a lower price. However, OBS Infrequent Access has lower availability than OBS Standard.
  • OBS Archive is applicable to archiving rarely accessed (once a year) data. The application scenarios include data archiving and long-term data retention for backup. OBS Archive is secure, durable, and inexpensive, which can replace tape libraries. However, it can take up to hours to restore data from OBS Archive.

Request Syntax

PUT / HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Content-Length: length
Date: date
Authorization: authorization

<CreateBucketConfiguration xmlns="http://obs.cn-north-1.myhwclouds.com/doc/2015-06-30/">
    <LocationConstraint>location</LocationConstraint>
</CreateBucketConfiguration>

Request Parameters

This request contains no parameter.

Request Headers

This request uses common headers. For details, see Table 1.

You can add optional headers to this request. Table 1 describes the optional headers.

Table 1 Optional request headers

Header

Description

Required or Optional

x-amz-acl

When creating a bucket, you can add this header in the request to set the ACL of a bucket. Possible values are privatepublic-readpublic-read-writeauthenticated-readbucket-owner-read, and bucket-owner-full-control. For details, see Table 3.

Type: string

Optional

x-default-storage-class

When creating a bucket, you can add this header in the request to set the bucket's default storage class, which can be STANDARD (OBS Standard), STANDARD_IA (OBS Infrequent Access), or GLACIER (OBS Archive). If this header is not specified in the request, the storage class of the bucket created is OBS Standard.

Type: string

Optional

x-amz-grant-read

Allowed to list objects.

Type: string

Example: x-amz-grant-read:id=account ID

Optional

x-amz-grant-write

Allowed to create, delete, and overwrite any object in the bucket.

Type: string

Example: x-amz-grant-write:id=account ID

Optional

x-amz-grant-read-acp

Allowed to read the bucket ACL.

Type: string

Example: x-amz-grant-read-acp:id=account ID

Optional

x-amz-grant-write-acp

Allowed to modify the bucket ACL.

Type: string

Example: x-amz-grant-write-acp:id=account ID

Optional

x-amz-grant-full-control

Granted all permissions.

Type: string

Example: x-amz-grant-full-control:id=account ID

Optional

Request Elements

This request contains one element, as described in Common Request Headers.

Table 2 Request element

Element

Description

Required or Optional

LocationConstraint

Indicates the region where a bucket will be created.

For details about OBS regions and endpoints, see Regions and Endpoints.

Type: string

Optional

Response Syntax

HTTP/1.1 status_code
Location: location
Date: date
Content-Length: length

Response Headers

This response uses common headers. For details, see Common Response Headers.

Response Elements

This response contains no element.

Error Responses

No special error responses are returned. For details about error responses, see Table 1.

Registration