You can call this operation to create a bucket.

Note
  • Anonymous access is not supported.
  • You can create up to 100 buckets in the same region with an Alibaba Cloud account.
  • Each region has corresponding endpoints. For more information about the mappings between regions and endpoints, see Regions and endpoints.

Request syntax

PUT / HTTP/1.1
Host: BucketName.oss-cn-hangzhou.aliyuncs.com
Date: GMT Date
x-oss-acl: Permission
Authorization: SignatureValue
<? xml version="1.0" encoding="UTF-8"? >
<CreateBucketConfiguration>
    <StorageClass>Standard</StorageClass>
</CreateBucketConfiguration>

Request headers

Header Type Required Description
x-oss-acl String No

Specifies the bucket ACL.

Valid values: public read/write, public read, and private

Note If no ACL is specified for the created bucket, the bucket ACL is set to private by default.

Request elements

Element Type Required Description
StorageClass String No

Specifies the storage class of the bucket.

Valid values:
  • Standard
  • IA (Infrequent Access)
  • Archive
  • ColdArchive
Note If no storage class is specified for the bucket, the storage class is set to Standard by default.
DataRedundancyType String No

Specifies the type of disaster recovery for a bucket.

Valid values:
  • LRS (local disaster recovery, default value)
  • ZRS (zone disaster recovery)

Examples

Sample requests
PUT / HTTP/1.1
Host: oss-example.oss-cn-hangzhou.aliyuncs.com
Date: Fri, 24 Feb 2017 03:15:40 GMT
x-oss-acl: private
Authorization: OSS qn6qrrqxo2oawuk53otfjbyc:77Dvh5wQgIjWjwO/KyRt8dOP****
<? xml version="1.0" encoding="UTF-8"? >
<CreateBucketConfiguration>
    <StorageClass>Standard</StorageClass>
</CreateBucketConfiguration>
Sample responses
HTTP/1.1 200 OK
x-oss-request-id: 534B371674E88A4D8906****
Date: Fri, 24 Feb 2017 03:15:40 GMT
Location: /oss-example
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS

SDKs

The SDKs of the PutBucket operation for various programming languages are as follows:

Error codes

Error code HTTP status code Description
InvalidBucketName 400 The error message returned because the bucket name does not comply with the naming conventions.
AccessDenied 403
  • The error message returned because the information for user authentication is not imported when you initiate a PutBucket request.
  • The error message returned because you are not authorized to perform this operation.
TooManyBuckets 400 The error message returned because the number of buckets to be created exceeds the upper limit. You can create up to 100 buckets in a region.