Creating a Bucket
Functions
This operation is used to create a bucket with a specified name.

- By default, a user can have a maximum of 100 buckets.
- The name of a deleted bucket can be reused for a bucket or a parallel file system at least 30 minutes after the deletion.
- You can enable WORM when you create a bucket. After WORM is enabled, you can configure retention policies for objects you upload to the bucket. For more information, see Configuring a Default WORM Policy for a Bucket. When you create a bucket with WORM enabled, OBS automatically enables versioning for the bucket, which cannot be suspended. When you create a parallel file system, you cannot enable WORM for it.
A bucket name must be unique in OBS. If a user creates a bucket with the same name as that of an existing bucket under the same account and in the same region, a 200 code (indicating success) is returned. In scenarios other than the preceding one, the request for creating a bucket with the same name as that of an existing one will receive the 409 code (indicating that a namesake bucket already exists). To set an access control policy for the bucket to be created, you can add the x-obs-acl parameter to request headers.
Storage Class
You can create buckets with different storage classes. The x-obs-storage-class header in a bucket creation request specifies the bucket's storage class. If you do not specify a storage class when you upload an object to the bucket, the object inherits the storage class of the bucket. The storage class options are as follows: STANDARD (Standard), WARM (Infrequent Access), COLD (Archive). If the x-obs-storage-class header is not in the request, a Standard bucket will be created.
If the storage class of an object is not specified when it is uploaded to a bucket (see Uploading an Object - PUT), the object will be stored in the default storage class of the bucket.
- OBS Standard features low access latency and high throughput. It is most suitable for storing frequently accessed (multiple times per month) hot files. Potential application scenarios include big data, mobile applications, trending videos, and social media images.
- OBS Infrequent Access is most suitable for storing semi-frequently accessed (less than 12 times a year) data requiring quick response. Potential application scenarios include file synchronization or sharing and enterprise-level backup. It provides the same durability, access latency, and throughput as the Standard but at a lower price. The main drawback, however, is that it has lower availability than the Standard.
- OBS Archive is most suitable for archiving rarely-accessed (averagely once a year) data. Potential application scenarios include data archiving and long-term data retention for backup. It provides secure, durable, and inexpensive storage, which can replace tape libraries. However, the low cost comes at the cost of minutes to hours needed to restore data from the Archive storage class.
Request Syntax
1 2 3 4 5 6 7 8 |
PUT / HTTP/1.1 Host: bucketname.obs.region.myhuaweicloud.eu Content-Length: length Date: date Authorization: authorization <CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.eu/doc/2015-06-30/"> <Location>location</Location> </CreateBucketConfiguration> |
Request Parameters
This request contains no parameters.
Request Headers
The operation message header is the same as that of a common request. For details, see Table 3. However, this request can contain additional headers. The following table describes the additional headers for this request.
Header |
Type |
Mandatory (Yes/No) |
Description |
---|---|---|---|
x-obs-acl |
String |
No |
Definition: When creating a bucket, you can use this parameter to set a pre-defined ACL. Range:
Default value: private |
x-obs-storage-class |
String |
No |
Definition: When creating a bucket, you can add this header to set the default storage class for the bucket. Range:
Default value: STANDARD |
x-obs-grant-read |
String |
No |
Definition: Grants the read permission to all users in a specified domain. It allows you to list objects in a bucket, list multipart tasks in a bucket, list multi-version objects in a bucket, and obtain bucket metadata. Example: x-obs-grant-read:id=tenant-ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-write |
String |
No |
Definition: Grants the WRITE permission to all users in a specified domain to create, delete, and overwrite all objects in a bucket; and initiate multipart uploads, upload parts, copy parts, assemble parts, and cancel multipart uploads. Example: x-obs-grant-write:id=tenant-ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-read-acp |
String |
No |
Definition: Grant the READ_ACP permission to all users in a specified domain to allow them to read the bucket ACL. Example: x-obs-grant-read-acp:id=Account ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-write-acp |
String |
No |
Definition: Grants the WRITE_ACP permission to all users in a specified domain to allow them to modify the bucket ACL. Example: x-obs-grant-write-acp:id=Account ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-full-control |
String |
No |
Definition: Grants the FULL_CONTROL permission to all users in a specified domain. Example: x-obs-grant-full-control:id=tenant-ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-read-delivered |
String |
No |
Definition: Grants the READ permission to all users in a specified domain. By default, the read permission is granted on all objects in the bucket. Example: x-obs-grant-read-delivered:id=tenant-ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-grant-full-control-delivered |
String |
No |
Definition: Grants the FULL_CONTROL permission to all users in a specified domain. By default, the FULL_CONTROL permission is granted on all objects in the bucket. Example: x-obs-grant-full-control-delivered:id=tenant-ID Constraints: None Range: id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information. Default value: None |
x-obs-fs-file-interface |
String |
No |
Definition: This header can be carried when you want to create a parallel file system. Example: x-obs-fs-file-interface:Enabled Range: Enabled Default value: If the header is specified, the value must be Enabled. There is no default value. |
x-obs-bucket-object-lock-enabled |
String |
No |
Definition: When creating a bucket, you can use this header to enable WORM for the bucket. Example: x-obs-bucket-object-lock-enabled:true Constraints: Only object buckets are supported. Range:
Default value: If the header is set to true, the object lock policy of the bucket is enabled. If the header is not set to true or is not carried, the object lock policy is disabled. |
x-obs-server-side-encryption-bucket-key-enabled |
String |
No |
Definition: Whether to enable the SSE-KMS bucket key feature. Constraints: If you set this header to true, you must also specify x-obs-server-side-encryption-kms-key-id to specify the key ID. Range:
Default value: false |
Request Elements
This request can use additional elements. For details about additional elements, see Table 2.
Element |
Type |
Mandatory (Yes/No) |
Description |
---|---|---|---|
Location |
String |
No |
Definition: Specifies the region where a bucket will be created. Constraints: If the endpoint used is obs.myhuaweicloud.eu, this parameter is not required. If any other endpoint is used, this parameter is required. Range: For details about OBS regions and endpoints, see Endpoints. Default value: If obs.myhuaweicloud.eu is used as the endpoint and no region is specified, eu-west-101 (the EU-Dublin region) is used by default. |
Response Syntax
1 2 3 4 |
HTTP/1.1 status_code Location: location Date: date Content-Length: length |
Response Headers
The response to the request uses common headers. For details, see Table 1.
Response Elements
This response contains no elements.
Error Responses
No special error responses are returned. For details about error responses, see Table 2.
Sample Request: Creating a Bucket
1 2 3 4 5 6 7 8 9 10 11 |
PUT / HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.eu Accept: */* Date: WED, 01 Jul 2015 02:25:05 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw= Content-Length: 157 <CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.eu/doc/2015-06-30/"> <Location>region</Location> </CreateBucketConfiguration> |
Sample Response: Creating a Bucket
1 2 3 4 5 6 7 |
HTTP/1.1 200 OK Server: OBS x-obs-request-id: BF260000016435CE298386946AE4C482 Location: /examplebucket x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz Date: WED, 01 Jul 2015 02:25:06 GMT Content-Length: 0 |
Sample Request: Creating a Bucket (with the ACL and Storage Class Specified)
1 2 3 4 5 6 7 8 9 10 11 12 13 |
PUT / HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.eu Accept: */* Date: WED, 01 Jul 2015 02:25:05 GMT x-obs-acl:public-read x-obs-storage-class:STANDARD Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw= Content-Length: 157 <CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.eu/doc/2015-06-30/"> <Location>region</Location> </CreateBucketConfiguration> |
Sample Response: Creating a Bucket (with the ACL and Storage Class Specified)
1 2 3 4 5 6 7 |
HTTP/1.1 200 OK Server: OBS x-obs-request-id: BF260000016435CE298386946AE4C482 Location: /examplebucket x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz Date: WED, 01 Jul 2015 02:25:06 GMT Content-Length: 0 |
Sample Request: Creating a Parallel File System
1 2 3 4 5 6 7 8 9 10 11 12 |
PUT / HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.eu Accept: */* Date: WED, 01 Jul 2015 02:25:05 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw= Content-Length: 157 x-obs-fs-file-interface: Enabled <CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.eu/doc/2015-06-30/"> <Location>region</Location> </CreateBucketConfiguration> |
Sample Response: Creating a Parallel File System
1 2 3 4 5 6 7 |
HTTP/1.1 200 OK Server: OBS x-obs-request-id: BF260000016435CE298386946AE4C482 Location: /examplebucket x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz Date: WED, 01 Jul 2015 02:25:06 GMT Content-Length: 0 |
Sample Request: Creating a Bucket with WORM Enabled
PUT / HTTP/1.1 User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.eu Accept: */* Date: WED, 01 Jul 2015 02:25:05 GMT Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw= x-obs-bucket-object-lock-enabled:true Content-Length: 0
Sample Response: Creating a Bucket with WORM Enabled
HTTP/1.1 200 OK Server: OBS x-obs-request-id: 00000184C11AC7A6809F881341842C02 x-reserved-indicator: Unauthorized Location: /examplebucket x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz Date: WED, 01 Jul 2015 02:25:06 GMT Content-Length: 0
Sample Request: Creating a Bucket with Explicitly Configured Access Permissions
PUT / HTTP/1.1 Authorization: OBS H4IPJX0TQTHTHEBQQCEC:iqSPeUBl66PwXDApxjRKk6hlcN4= x-obs-grant-read: id=783fc6vz2cf2442c096evxxxxxxxxxxxx x-obs-grant-write: id=3u3fc6vz2cf24mc830fhsxxxxxxxxxxxx x-obs-grant-read-acp: id=902su2vz2cf2vire.239caxxxxxxxxxxxx User-Agent: curl/7.29.0 Host: examplebucket.obs.region.myhuaweicloud.com Date: WED, 01 Jul 2015 02:37:22 GMT Content-Type: application/xml <CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/"> <Location>region</Location> </CreateBucketConfiguration>
Sample Response: Creating a Bucket with Explicitly Configured Access Permissions
x-obs-id-2: 32AAAQAAEAABAAAQAAEAABAAAQAAEAABCTeau73DlKTh4wPYzoZf5w3KacolerP4 x-obs-request-id: 0000018A2A22B72447CF01A99F32E2B0 Server: OBS Content-Length: 0 Date: WED, 01 Jul 2015 02:37:22 GMT Location: /examplebucket
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.