【问题标题】:How to create bucket in the AWS S3 via Postman如何通过 Postman 在 AWS S3 中创建存储桶
【发布时间】:2016-10-19 21:19:55
【问题描述】:

我使用 Postman AWS Signature 连接 S3 服务,我可以获取所有存储桶,该存储桶内的文件夹,也可以删除该存储桶。

这是我可以通过 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>/]

当我想创建一个存储桶(PUT 方法)时,它会响应我一条错误消息。

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

所以问题。如何通过 Postman 创建存储桶?提前致谢。

【问题讨论】:

    标签: amazon-web-services amazon-s3 postman


    【解决方案1】:

    AWS 关于通过 API 调用创建存储桶的文档提到您可以在请求正文中提供位置约束:

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

    尝试使用您选择的区域添加它:

    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]
    

    这是完整的语法:

    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>
    

    来源:AWS Docs

    【讨论】:

    • 如果答案对您有用,请将其标记为已接受,以便有类似问题的人也可以找到解决方案。
    猜你喜欢
    • 1970-01-01
    • 2020-05-26
    • 1970-01-01
    • 2017-04-24
    • 2020-05-04
    • 1970-01-01
    • 1970-01-01
    • 2017-12-25
    • 2020-07-16
    相关资源
    最近更新 更多