forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
215 lines
19 KiB
HTML
215 lines
19 KiB
HTML
<a name="EN-US_TOPIC_0125560305"></a><a name="EN-US_TOPIC_0125560305"></a>
|
|
|
|
<h1 class="topictitle1">PUT Bucket</h1>
|
|
<div id="body18564111"><p id="EN-US_TOPIC_0125560305__p54806219">You can send the <strong id="EN-US_TOPIC_0125560305__b32859274">PUT Bucket</strong> request to create a bucket with the specified name.</p>
|
|
<div class="note" id="EN-US_TOPIC_0125560305__note23493928"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0125560305__ul4191742113612"><li class="text" id="EN-US_TOPIC_0125560305__li14981545154119">You can create a maximum of 100 buckets.</li><li id="EN-US_TOPIC_0125560305__li1531317173514">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 <a href="en-us_topic_0000001806313033.html">Configuring a Default WORM Policy for a Bucket</a>. 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.</li></ul>
|
|
</div></div>
|
|
<p id="EN-US_TOPIC_0125560305__p10118767">The name of a bucket must be unique in OBS. If a user repeatedly creates namesake buckets in the same region, status code <strong id="EN-US_TOPIC_0125560305__b76377311489">200</strong> is returned. If namesake buckets are repeatedly created in other cases, status code <strong id="EN-US_TOPIC_0125560305__b1857441374811">409</strong> is returned. You can set the ACL of a bucket by adding optional header <strong id="EN-US_TOPIC_0125560305__b44355518">x-amz-acl</strong> to a request.</p>
|
|
<div class="note" id="EN-US_TOPIC_0125560305__note23960039"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0125560305__p55170850161711">In multiple regions scenarios, if user A creates a bucket, deletes the bucket later, and immediately creates a bucket with the same name in different regions, the system will respond <strong id="EN-US_TOPIC_0125560305__b1970124344814">409</strong>. If user A creates a bucket with the same name in different regions 30 minutes later, the system will respond <strong id="EN-US_TOPIC_0125560305__b10199133994817">200</strong>.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p3836447020218">If a 5<em id="EN-US_TOPIC_0125560305__i732732184916">xx</em> error is returned from the server or the request times out during bucket creation, the system takes about 10 minutes to make bucket information consistent. During the process, bucket information is inaccurate.</p>
|
|
</div></div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section47363625202820"><h4 class="sectiontitle">Storage Class</h4><p id="EN-US_TOPIC_0125560305__p34127054202820">Users are allowed to create buckets of different storage classes. The <strong id="EN-US_TOPIC_0125560305__b38708033202820">x-default-storage-class</strong> 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 Warm), and GLACIER (OBS Cold). If this header is not in the request, the storage class of the bucket created is OBS Standard. When users upload an object to a bucket, if they do not set the storage class of the object (see <a href="en-us_topic_0125560399.html">PUT Object</a>), the object will use the default storage class of the bucket.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section38116128"><h4 class="sectiontitle">Request Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen17691597104928">PUT / HTTP/1.1
|
|
User-Agent: agent
|
|
Host: Host Server
|
|
Accept: */*
|
|
Date: date
|
|
Authorization: authorization
|
|
Content-Length: 0
|
|
<Optional Additional Header>
|
|
|
|
<CreateBucketConfiguration xmlns="http://obs.example.com/doc/2015-06-30/">
|
|
<LocationConstraint>location</LocationConstraint>
|
|
</CreateBucketConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section7500834"><h4 class="sectiontitle">Request Parameters</h4><p id="EN-US_TOPIC_0125560305__p50339135">This request involves no parameters.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section398650"><h4 class="sectiontitle">Request Headers</h4><p id="EN-US_TOPIC_0125560305__p50938166">This request uses common headers. For details about common request headers, see section <a href="en-us_topic_0125560462.html">Common Request Headers</a>.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p22721246">You can add optional headers to this request. <a href="#EN-US_TOPIC_0125560305__table31170320">Table 1</a> describes the optional headers.</p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560305__table31170320"></a><a name="table31170320"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560305__table31170320" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Optional request headers</caption><thead align="left"><tr id="EN-US_TOPIC_0125560305__row47912089"><th align="left" class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.3.8.4.2.4.1.1"><p id="EN-US_TOPIC_0125560305__p55673999">Header</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.3.8.4.2.4.1.2"><p id="EN-US_TOPIC_0125560305__p13300041">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.333333333333336%" id="mcps1.3.8.4.2.4.1.3"><p id="EN-US_TOPIC_0125560305__p3561519">Remarks</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560305__row20047659"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560305__p13247650">x-amz-acl</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560305__p66426750">Indicates the ACL of a bucket. Possible values are <strong id="EN-US_TOPIC_0125560305__b60969846">private</strong>, <strong id="EN-US_TOPIC_0125560305__b11857703">public-read</strong>, <strong id="EN-US_TOPIC_0125560305__b39610468">public-read-write</strong>, <strong id="EN-US_TOPIC_0125560305__b20949892">authenticated-read</strong>, <strong id="EN-US_TOPIC_0125560305__b54331306">bucket-owner-read</strong>, and <strong id="EN-US_TOPIC_0125560305__b19219710">bucket-owner-full-control</strong>. For details, see <a href="en-us_topic_0125560406.html#EN-US_TOPIC_0125560406__table40200743">Table 4</a>.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p13292668">Type: String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560305__p2964327">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560305__row23889184203239"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560305__p57471669203319">x-default-storage-class</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560305__p14900873203330">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 Warm), and GLACIER (OBS Cold). If this header is not specified in the request, the storage class of the bucket created is OBS Standard.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p66998998203330">Type: String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560305__p34271861203337">Optional</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560305__row1772355541119"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560305__p2636530171316">x-amz-security-token</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560305__p176361330141312">Header field used to identify the request of a federated user. When the federal authentication function is enabled, users sending such requests are identified as federated users.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p186362030201310">Type: string</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560305__p1063603061316">Optional. This parameter must be carried in the request sent by federated users.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="EN-US_TOPIC_0125560305__row1620161134216"><td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.1 "><p id="EN-US_TOPIC_0125560305__p04291941114615">x-amz-bucket-object-lock-enabled</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.2 "><p id="EN-US_TOPIC_0125560305__p1883212934612">When creating a bucket, you can use this header to enable WORM for the bucket.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p136881949174813">Type: string</p>
|
|
<p id="EN-US_TOPIC_0125560305__p373012503474">Example: <strong id="EN-US_TOPIC_0125560305__b02545418234">x-amz-bucket-object-lock-enabled:true</strong></p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.333333333333336%" headers="mcps1.3.8.4.2.4.1.3 "><p id="EN-US_TOPIC_0125560305__p16832229194616">No</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section5296112755414"><h4 class="sectiontitle">Request Elements</h4><p id="EN-US_TOPIC_0125560305__p16625293">This request contains one element, as described in <a href="#EN-US_TOPIC_0125560305__table5512965">Table 2</a></p>
|
|
|
|
<div class="tablenoborder"><a name="EN-US_TOPIC_0125560305__table5512965"></a><a name="table5512965"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0125560305__table5512965" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request element</caption><thead align="left"><tr id="EN-US_TOPIC_0125560305__row5892555"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.1"><p id="EN-US_TOPIC_0125560305__p7534928">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.2"><p id="EN-US_TOPIC_0125560305__p6349446">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.9.3.2.4.1.3"><p id="EN-US_TOPIC_0125560305__p44543124">Remarks</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0125560305__row51223331"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.1 "><p id="EN-US_TOPIC_0125560305__p55449179">LocationConstraint</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.2 "><p id="EN-US_TOPIC_0125560305__p62198499">Indicates the Region where a bucket will be created. This element is contained in <strong id="EN-US_TOPIC_0125560305__b22915580">CreateBucketConfiguration</strong>.</p>
|
|
<p id="EN-US_TOPIC_0125560305__p4913635">Type: String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.9.3.2.4.1.3 "><p id="EN-US_TOPIC_0125560305__p62460164">Optional</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section61603605"><h4 class="sectiontitle">Response Syntax</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen43716622104944">HTTP/1.1 status_code
|
|
x-amz-request-id: request id
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Location: location
|
|
x-amz-id-2: id
|
|
Date: date
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section17561535"><h4 class="sectiontitle">Response Headers</h4><p id="EN-US_TOPIC_0125560305__p15925207">This response uses common headers. For details about common response headers, see section <a href="en-us_topic_0125560484.html">Common Response Headers</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section23836090"><h4 class="sectiontitle">Response Elements</h4><p id="EN-US_TOPIC_0125560305__p63896804">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section13198224"><h4 class="sectiontitle">Error Responses</h4><p id="EN-US_TOPIC_0125560305__p8258615">No special error responses are returned. For details about error responses, see <a href="en-us_topic_0125560440.html#EN-US_TOPIC_0125560440__table30733758">Table 1</a>.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section12795575"><h4 class="sectiontitle">Sample Request</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen35401010533">PUT / HTTP/1.1
|
|
User-Agent: Jakarta Commons-HttpClient/3.1
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Sat, 03 Dec 2011 06:31:58 +0000
|
|
Authorization: AWS BF6C09F302931425E9A7:QBaO+tS/76QYHVnUoxvf9EPH/3o=
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section48051319"><h4 class="sectiontitle">Sample Response</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen20164173105318">HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-amz-request-id: 001B21A61C6C00000134029F41D1527F
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Location: /bucketname
|
|
x-amz-id-2: MDAxQjIxQTYxQzZDMDAwMDAxMzQwMjlGNDFEMTUyN0ZBQUFBQUFBQWJiYmJiYmJi
|
|
Date: Sat, 03 Dec 2011 06:31:58 GMT
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section29808687"><h4 class="sectiontitle">Sample Request (Example of Setting the Region of a Bucket)</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen30806076105332">PUT / HTTP/1.1
|
|
User-Agent: Jakarta Commons-HttpClient/3.1
|
|
Host: bucketname.obs.example.com
|
|
Accept: */*
|
|
Date: Sat, 03 Dec 2011 06:31:58 +0000
|
|
Authorization: AWS BF6C09F302931425E9A7:QBaO+tS/76QYHVnUoxvf9EPH/3o=
|
|
Content-Length: 149
|
|
|
|
<CreateBucketConfiguration xmlns="http://obs.example.com/doc/2015-06-30/">
|
|
<LocationConstraint>EU</LocationConstraint>
|
|
</CreateBucketConfiguration></pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section66951593"><h4 class="sectiontitle">Sample Response (Example of Setting the Region of a Bucket)</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen60083759105349">HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-amz-request-id: 001B21A61C6C00000134029F41D1527F
|
|
x-reserved: amazon, aws and amazon web services are trademarks or registered trademarks of Amazon Technologies, Inc
|
|
Location: /bucketname
|
|
x-amz-id-2: MDAxQjIxQTYxQzZDMDAwMDAxMzQwMjlGNDFEMTUyN0ZBQUFBQUFBQWJiYmJiYmJi
|
|
Date: Sat, 03 Dec 2011 06:31:58 GMT
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section1593874119494"><h4 class="sectiontitle">Sample Request (Example of Creating a parallel file system)</h4><div class="codecoloring" codetype="Xml" id="EN-US_TOPIC_0125560305__screen152931411562"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
|
|
<span class="normal"> 2</span>
|
|
<span class="normal"> 3</span>
|
|
<span class="normal"> 4</span>
|
|
<span class="normal"> 5</span>
|
|
<span class="normal"> 6</span>
|
|
<span class="normal"> 7</span>
|
|
<span class="normal"> 8</span>
|
|
<span class="normal"> 9</span>
|
|
<span class="normal">10</span></pre></div></td><td class="code"><div><pre><span></span>PUT<span class="w"> </span>/<span class="w"> </span>HTTP/1.1
|
|
User-Agent:<span class="w"> </span>curl/7.29.0
|
|
Host:<span class="w"> </span>examplebucket.obs.region.example.com
|
|
Accept:<span class="w"> </span>*/*
|
|
Date:<span class="w"> </span>WED,<span class="w"> </span>01<span class="w"> </span>Jul<span class="w"> </span>2015<span class="w"> </span>02:25:05<span class="w"> </span>GMT
|
|
Authorization:<span class="w"> </span>AWS<span class="w"> </span>H4IPJX0TQTHTHEBQQCEC:75/Y4Ng1izvzc1nTGxpMXTE6ynw=
|
|
Content-Length:<span class="w"> </span>157
|
|
<span class="nt"><CreateBucketConfiguration</span><span class="w"> </span><span class="na">xmlns=</span><span class="s">"http://obs.region.example.com/doc/2015-06-30/"</span><span class="nt">></span>
|
|
<span class="nt"><Location></span>region<span class="nt"></Location></span><span class="w"> </span>
|
|
<span class="nt"></CreateBucketConfiguration></span>
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section16939941164914"><h4 class="sectiontitle">Sample Response (Example of Creating a parallel file system)</h4><div class="codecoloring" codetype="Xml" id="EN-US_TOPIC_0125560305__screen32947410563"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span>
|
|
<span class="normal">2</span>
|
|
<span class="normal">3</span>
|
|
<span class="normal">4</span>
|
|
<span class="normal">5</span>
|
|
<span class="normal">6</span>
|
|
<span class="normal">7</span></pre></div></td><td class="code"><div><pre><span></span>HTTP/1.1<span class="w"> </span>200<span class="w"> </span>OK
|
|
Server:<span class="w"> </span>OBS
|
|
x-amz-request-id:<span class="w"> </span>BF260000016435CE298386946AE4C482
|
|
Location:<span class="w"> </span>/examplebucket
|
|
x-amz-id-2:<span class="w"> </span>32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz
|
|
Date:<span class="w"> </span>WED,<span class="w"> </span>01<span class="w"> </span>Jul<span class="w"> </span>2015<span class="w"> </span>02:25:06<span class="w"> </span>GMT
|
|
Content-Length:<span class="w"> </span>0
|
|
</pre></div></td></tr></table></div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section62827378569"><h4 class="sectiontitle">Sample Request for Creating a Bucket with WORM Enabled</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen9331457195713">PUT / HTTP/1.1
|
|
User-Agent: curl/7.29.0
|
|
Host: examplebucket.obs.region.example.com
|
|
Accept: */*
|
|
Date: WED, 01 Jul 2015 02:25:05 GMT
|
|
Authorization: authorization
|
|
x-amz-bucket-object-lock-enabled:true
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0125560305__section21791905571"><h4 class="sectiontitle">Sample Response for Creating a Bucket with WORM Enabled</h4><pre class="screen" id="EN-US_TOPIC_0125560305__screen3134132318214">HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-amz-request-id: 00000184C11AC7A6809F881341842C02
|
|
x-reserved-indicator: Unauthorized
|
|
Location: /examplebucket
|
|
x-amz-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCT9W2tcvLmMJ+plfdopaD62S0npbaRUz
|
|
Date: WED, 01 Jul 2015 02:25:06 GMT
|
|
Content-Length: 0</pre>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0125560493.html">Operations on Buckets</a></div>
|
|
</div>
|
|
</div>
|
|
|