简体   繁体   English

如何通过Postman在AWS S3中创建存储桶

[英]How to create bucket in the AWS S3 via Postman

I used Postman AWS Signature to connect with S3 service and I could get all buckets, folder inside that bucket, also I could delete the bucket. 我使用Postman AWS Signature连接S3服务,我可以获得桶中的所有桶,文件夹,我也可以删除桶。

Here is a list of requests which I can do via Postman. 以下是我可以通过Postman进行的请求列表。

List of all bucket inside the specific region: GET    https://s3-us-west-2.amazonaws.com/
List of all objects/folders inside the bucket: GET    https://s3-us-west-2.amazonaws.com/<bucket name>
Delete the bucket/file (when it's empty):      DELETE https://s3-us-west-2.amazonaws.com/<bucket name>/[<file name>]
Create the file into the bucket:               PUT    https://s3-us-west-2.amazonaws.com/<bucket name>/[<file name>][<folder name>/]

When I want to create a bucket (PUT method), it's response me an error message. 当我想创建一个桶(PUT方法)时,它会回复我一条错误消息。

The unspecified location constraint is incompatible for the region specific endpoint this request was sent to

So the question. 所以问题。 How can I create bucket via Postman? 如何通过Postman创建桶? Thanks in advance. 提前致谢。

The documentation by AWS for creating a bucket through an API call mentions you can provide a location constraint in the body of the request: AWS通过API调用创建存储桶的文档提到您可以在请求正文中提供位置约束:

<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> 
    <LocationConstraint>YourBucketRegion</LocationConstraint> 
</CreateBucketConfiguration>

Try adding it with the region of your choosing: 尝试将其添加到您选择的区域:

Valid Values: [ us-west-1 | us-west-2 | EU or eu-west-1 | 
eu-central-1 | ap-south-1 | ap-southeast-1 | ap-southeast-2 | 
ap-northeast-1 | ap-northeast-2 | sa-east-1 | us-east-2]

Here is the full syntax: 以下是完整语法:

PUT / HTTP/1.1
Host: BucketName.s3.amazonaws.com
Content-Length: length
Date: date
Authorization: authorization string (see Authenticating Requests (AWS Signature Version
    4))

<CreateBucketConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> 
<LocationConstraint>BucketRegion</LocationConstraint> 
</CreateBucketConfiguration>

Source: AWS Docs 来源: AWS Docs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM