如何在欧盟和美国以外的其他地方创建GS Bucket?

时间:2013-08-16 09:28:25

标签: google-cloud-storage google-cloud-endpoints

我正在编写示例代码以在Google云端存储中创建Bucket。我正在关注在link -

编写的XML API
PUT / HTTP/1.1
Host: helloworld.storage.googleapis.com
Accept-Encoding: identity
Date: Fri, 01 Apr 2011 21:52:39 GMT
Content-Length: 92
x-goog-api-version: 2
x-goog-project-id: 123456789123
Authorization: Bearer 1/zVNpoQNsOSxZKqOZgckhpQ

<xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration>
  <LocationConstraint>EU</LocationConstraint>
</CreateBucketConfiguration> 

Google存储位置 -

EU - European Union
US - United States
US-EAST1 - Eastern United States
US-EAST2 - Eastern United States
US-EAST3 - Eastern United States
US-CENTRAL1 - Central United States
US-CENTRAL2 - Central United States
US-WEST1 - Western United States

如果我在<LocationConstraint>标签中提供美国和欧盟,我可以创建Bucket。但如果我给的不是这两个,请说 - <LocationConstraint>标签中的US-CENTRAL2为 -

<xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration>
   <LocationConstraint>US-CENTRAL2</LocationConstraint>
</CreateBucketConfiguration> 

然后在创建存储桶上,此代码抛出错误 -

Encountered too many Internal Server errors (6), aborting request. PUT '/mybucket/' on Host 'commondatastorage.googleapis.com' @ 'Fri, 16 Aug 2013 09:08:21 GMT' -- ResponseCode: 500, ResponseStatus: Internal Server Error

如何在美国和欧盟地区以外的其他六个区域创建水桶? API ??

是否有任何变化

感谢您的帮助,

Neelam Sharma

1 个答案:

答案 0 :(得分:3)

要在美国和欧盟以外的其他地方创建存储桶,我们需要通过添加一个值为DURABLE_REDUCED_AVAILABILITY的标记<StorageClass>来发送PUT存储桶的请求 -

<xml version="1.0" encoding="UTF-8"?>
<CreateBucketConfiguration>
   <LocationConstraint>US-CENTRAL2</LocationConstraint>
   <StorageClass>DURABLE_REDUCED_AVAILABILITY</StorageClass>
</CreateBucketConfiguration> 

添加此标记解决了我的问题。