PutBucket is used to create a bucket (anonymous access is not supported).

The region where a bucket is created is consistent with the region of the endpoint from which the request is sent. Once the region of a bucket is determined, all objects in the bucket are stored in the region. For more information, 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"? >

Request header

Table 1. Request header
Type Description
x-oss-acl String Specifies the ACL for the bucket.

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

Request element

Table 2. Request element
Type Description
StorageClass String Specifies the storage class of the bucket.

Valid values: Standard, IA, and Archive.

Detail analysis

  • The ACL for a bucket is private by default if it is not specified when the bucket is created.
  • If the bucket name does not conform to the naming convention, a 400 Bad Request message is returned with an error code: InvalidBucketName.
  • If user authentication information is not carried in a PutBucket request, a 403 Forbidden message is returned with an error code: AccessDenied.
  • You can create up to 30 buckets within the same region. If more than 30 buckets are created within a region, a 400 Bad Request message is returned with an error code: TooManyBuckets.
  • When creating a bucket, you can specify the data redundancy type (DataRedundancyType) of the bucket. The valid values include: LRS (local data redundancy, default value) and ZRS (zone redundancy).


Request example:

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/KyRt8dOPfo8=
<? xml version="1.0" encoding="UTF-8"? >

Response example:

HTTP/1.1 200 OK
x-oss-request-id: 534B371674E88A4D8906008B
Date: Fri, 24 Feb 2017 03:15:40 GMT
Location: /oss-example
Content-Length: 0
Connection: keep-alive
Server: AliyunOSS