หน้านี้ยังไม่พร้อมใช้งานในภาษาท้องถิ่นของคุณ เรากำลังพยายามอย่างหนักเพื่อเพิ่มเวอร์ชันภาษาอื่น ๆ เพิ่มเติม ขอบคุณสำหรับการสนับสนุนเสมอมา

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive

Creating a Bucket

Updated on 2024-09-29 GMT+08:00

Functions

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

NOTE:
  • 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.
  • When creating a bucket in OBS, you can enable the multi-AZ mode for the bucket or disable it. With the multi-AZ mode disabled, data in a bucket is stored in a single AZ by default. With the multi-AZ mode enabled, data in a bucket is stored redundantly in multiple AZs, improving reliability. However, buckets created before are still in the single AZ mode.
  • You can enable WORM when you create a bucket, but you cannot enable WORM for an existing bucket. In a bucket with WORM enabled, you can further configure retention policies for objects you upload to this bucket. For more information, see Configuring a Default WORM Policy for a Bucket. Once enabled, WORM cannot be disabled for a bucket. When you create a bucket with WORM enabled, OBS automatically enables versioning for the bucket and the versioning cannot be suspended for that bucket. 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), DEEP_ARCHIVE (Deep 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.
  • Deep Archive: The Deep Archive storage class (under limited beta testing) is suitable for storing data that is barely (once every few years) accessed. This storage class costs less than the Archive storage class, but takes longer time (usually several hours) to restore data.

Request Syntax

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
PUT / HTTP/1.1 
Host: bucketname.obs.region.myhuaweicloud.com
Content-Length: length
Date: date
Authorization: authorization
x-obs-az-redundancy: 3az
<CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.com/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.

Table 1 Additional request headers

Header

Type

Mandatory (Yes/No)

Description

x-obs-acl

String

No

Explanation:

When creating a bucket, you can use this parameter to set a pre-defined ACL.

Value range:

  • private: A bucket or an object can be accessed only by its owner.
  • public-read: If this permission is granted on a bucket, anyone can read the object list, multipart uploads, and bucket metadata.
  • public-read-write: If this permission is granted on a bucket, anyone can obtain the object list, multipart tasks, and metadata, and can upload or delete objects, initiate multipart upload tasks, upload parts, assemble parts, copy parts, and cancel multipart upload tasks.
  • public-read-delivered: If this permission is set for a bucket, everyone can obtain the object list, multipart uploads, and bucket metadata in the bucket, and obtain the content and metadata of the objects in the bucket.
  • public-read-delivered: If this permission is set for a bucket, everyone can obtain the object list in the bucket, multipart uploads in the bucket, metadata of the bucket; upload objects; delete objects; initiate multipart uploads; upload parts; assemble parts; copy parts; cancel multipart uploads; obtain content and metadata of objects in the bucket.
  • bucket-owner-full-control: If this permission is granted on an object, only the bucket and object owners have the full control over the object.

    By default, if you upload an object to a bucket of any other user, the bucket owner does not have the permissions on your object. After you grant this policy to the bucket owner, the bucket owner can have full control over your object.

    For example, if user A uploads object x to user B's bucket, user B does not have the control over object x. If user A sets the bucket-owner-full-control policy for object x, user B then has the control over object x.

Default value:

private

x-obs-storage-class

String

No

Explanation:

When creating a bucket, you can add this header to set the default storage class for the bucket.

Value range:

  • STANDARD (Standard storage)
  • WARM (Infrequent Access storage)
  • COLD (Archive storage)
  • DEEP_ARCHIVE (Deep Archive storage)

Default value:

STANDARD

x-obs-grant-read

String

No

Explanation:

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

Restrictions:

None

Value 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

Explanation:

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

Restrictions:

None

Value 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

Explanation:

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

Restrictions:

None

Value 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

Explanation:

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

Restrictions:

None

Value 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

Explanation:

Grants the FULL_CONTROL permission to all users in a specified domain.

Example: x-obs-grant-full-control:id=tenant-ID

Restrictions:

None

Value 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

Explanation:

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

Restrictions:

None

Value 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

Explanation:

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

Restrictions:

None

Value range:

id=tenant-ID. For details, see Obtaining Account, IAM User, Project, User Group, Region, and Agency Information.

Default value:

None

x-obs-az-redundancy

String

No

Explanation:

If this header is carried when a bucket is created, the storage class of the bucket is set to multi-AZ. Otherwise, the storage class of the bucket is set to single-AZ. Example: x-obs-az-redundancy:3az

Restrictions:

This header is carried to specify that a newly created bucket uses multi-AZ storage. If the region where the bucket resides does not support multi-AZ storage, the bucket still uses the single-AZ storage.

Value range:

3az

Default value:

If the header is specified, the value must be 3az. There is no default value. Otherwise, single AZ is used by default.

x-obs-fs-file-interface

String

No

Explanation:

This header can be carried when you want to create a parallel file system.

Example: x-obs-fs-file-interface:Enabled

Value range:

Enabled

Default value:

If the header is specified, the value must be Enabled. There is no default value.

x-obs-epid

String

No

Explanation:

Enterprise project ID. Users who have enabled the enterprise project function can obtain this ID in UUID format from the enterprise project service. The default project ID is 0. This header can be not included. This header is not required for users who have not enabled the enterprise project function.

Example: x-obs-epid:9892d768-2d13-450f-aac7-ed0e44c2585f

Restrictions:

None

Value range:

The value can be 0 or your actual enterprise project ID.

Default value:

0

x-obs-bucket-type

String

No

Explanation:

You can add this header to specify what type of bucket you will create. You can choose to create a bucket or a parallel file system.

Example: x-obs-bucket-type:OBJECT

Restrictions:

None

Value range:

  • OBJECT: a bucket
  • POSIX: a parallel file system.

Default value:

If the header is specified, the value must be manually entered. There is no default value. If the header is not specified, OBJECT is used by default.

x-obs-bucket-object-lock-enabled

String

No

Explanation:

When creating a bucket, you can use this header to enable WORM for the bucket.

Example: x-obs-bucket-object-lock-enabled:true

Restrictions:

Only object buckets are supported.

Value range:

  • true: WORM is enabled.
  • false: WORM is disabled.

Default value:

If the header is specified, the value must be true. There is no default value. If the header is not specified, the function is disabled.

x-obs-server-side-encryption

String

No

Explanation:

When creating a bucket, you can use this header to specify an encryption method for the bucket.

Example: x-obs-server-side-encryption: kms

Restrictions:

None

Value range:

  • kms
  • obs

Default value:

If the header is specified, the value must be manually entered. There is no default value. If the header is not specified, bucket encryption is disabled.

x-obs-server-side-data-encryption

String

No

Explanation:

When creating a bucket, you can use this header to specify an encryption algorithm for server-side encryption.

Example: x-obs-server-side-data-encryption: AES256

Restrictions:

None

Value range:

  • AES256

You can set this header to AES256 if x-obs-server-side-encryption:kms is used.

You can set this header to AES256 if x-obs-server-side-encryption:obs is used.

Default value:

None

x-obs-server-side-encryption-kms-key-id

String

No if x-obs-server-side-encryption:kms is used.

Explanation:

ID of a specified key used for SSE-KMS encryption. For details about how to obtain a key ID, see Viewing a Key.

Type: string

Restrictions:

This header can only be used when you specify kms for the x-obs-server-side-encryption header.

Default value:

If you specify kms for encryption but do not specify a key ID, the default master key will be used. If there is not a default master key, OBS will create one and use it.

x-obs-sse-kms-key-project-id

String

This parameter can be used only when x-obs-server-side-encryption-kms-key-id is included.

Explanation:

ID of the project (not an enterprise project) where the KMS CMK belongs when SSE-KMS is used

Restrictions:

None

Value range:

A project ID (not an enterprise project ID) that matches the KMSMasterKeyID specified by x-obs-server-side-encryption-kms-key-id

Default value:

None

Request Elements

This request can use additional elements. For details about additional elements, see Table 2.

Table 2 Additional request elements

Element

Type

Mandatory (Yes/No)

Description

Location

String

No

Explanation:

Specifies the region where a bucket will be created.

  • When the endpoint of the CN North-Beijing1 region is used for bucket creation:
    • if location is not included, the bucket will be created in CN North-Beijing1 (cn-north-1) by default.
    • if another region, for example, CN-Hong Kong (ap-southeast-1), is specified for location, the bucket will be created in the CN-Hong Kong region.
  • When the endpoint of a region other than CN North-Beijing1 is used for bucket creation, location must be set to the region that the used endpoint corresponds to.

    For example, if obs.ap-southeast-1.myhuaweicloud.com is used, you must set location to ap-southeast-1.

Restrictions:

If the used endpoint is obs.myhuaweicloud.com, this parameter is not required. If any other endpoint is used, this parameter is required.

Value range:

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

Default value:

If obs.myhuaweicloud.com is used as the endpoint and no region is specified, cn-north-1 (the CN North-Beijing1 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.com
Accept: */*
Date: WED, 01 Jul 2015 02:25:05 GMT
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
Content-Length: 157

<CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.com/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.com
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.com/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 Bucket with Multi-AZ Storage

1
2
3
4
5
6
7
8
9
PUT / HTTP/1.1 
Host: examplebucket.obs.region.myhuaweicloud.com
Content-Length: length 
Date: date 
Authorization: authorization 
x-obs-az-redundancy:3az 
<CreateBucketConfiguration xmlns="http://obs.region.myhuaweicloud.com/doc/2015-06-30/"> 
 <Location>region</Location> 
</CreateBucketConfiguration>

Sample Response: Creating a Bucket with Multi-AZ Storage

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.com
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.com/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.com
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

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback