【问题标题】:aws s3api create-bucket —bucket make exceptionaws s3api create-bucket —bucket 异常
【发布时间】:2018-08-16 21:34:00
【问题描述】:

我正在尝试使用

创建一个 S3 存储桶

aws s3api create-bucket —bucket kubernetes-aws-wthamira-io

它给出了这个错误:

An error occurred (IllegalLocationConstraintException) when calling
the CreateBucket operation: The unspecified location constraint is
incompatible for the region specific endpoint this request was sent
to.

我将使用aws configure 的区域设置为eu-west-1

Default region name [eu-west-1]: 

但它给出了同样的错误。我该如何解决?

我用osx终端连接aws

【问题讨论】:

  • 我正在使用aws s3 并得到相同的问题输出。尝试添加--region 来设置约束可以帮助我解决这个问题。与 s3api 中的LocationConstraint 工作方式相同

标签: amazon-web-services amazon-s3 kubernetes kops


【解决方案1】:

试试这个:

aws s3api create-bucket --bucket kubernetes-aws-wthamira-io --create-bucket-configuration LocationConstraint=eu-west-1

us-east-1 之外的区域需要指定适当的 LocationConstraint 才能在所需区域中创建存储桶。

https://docs.aws.amazon.com/cli/latest/reference/s3api/create-bucket.html

【讨论】:

  • 为了彻底,该示例应包括 --region 选项:该命令将需要 --region 选项和 --create-bucket-configuration 选项(冗余)指定区域,例如aws s3api create-bucket --bucket kubernetes-aws-wthamira-io --region eu-west-1 --create-bucket-configuration LocationConstraint=eu-west-1
  • @Everett:在我的情况下,它在没有 --region 选项的情况下工作。
  • 如果有人直接使用 REST APi,那么您不需要传递 us-east-1 位置的有效负载。
  • @Matej 如果为使用的配置文件定义了默认值并且它与LocationConstraint值不同,您只需指定--region
【解决方案2】:

使用 mb 为我们解决了问题

aws s3 mb s3://storage.example.com --region us-west-1

【讨论】:

    【解决方案3】:

    如果您尝试创建一个名称已被占用的存储桶,您也会收到此错误。

    所以尝试给你的存储桶一个更独特的名称,然后它应该可以工作(我只是在存储桶名称的末尾添加了数字)。

    【讨论】:

    • 这与名称无关,由于区域限制而发生此错误@omari
    【解决方案4】:

    我已经看到很多答案,例如关于“LocationConstraint”的第一个答案。答案是正确的,但只涵盖了一半的情况。我试图包含“LocationConstraint”来解决问题,但仍然遇到同样的错误。这是 Omar Zairi 的第二个回答给了我一个线索。

    这里的信息实际上非常混乱。当您尝试创建名称已被占用的存储桶时,只有当您配置的区域与已占用名称的存储桶区域相同时,您才会收到消息“请求的存储桶名称不可用”。否则,您会收到“位置约束与此请求发送到的区域特定端点不兼容”。

    若要查找名称是否已被占用,以及是否已被占用,具有该名称的存储桶位于哪个区域,请查看“the-name.s3.amazonaws.com”的 DNS 记录。

    下面我使用一个取名“test8765”来显示我上面提到的内容。希望这对像我一样感到困惑的人有所帮助。

    bing@bingstp:~$ dig test8765.s3.amazonaws.com
    
    ; <<>> DiG 9.11.3-1ubuntu1.3-Ubuntu <<>> test8765.s3.amazonaws.com
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39766
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 65494
    ;; QUESTION SECTION:
    ;test8765.s3.amazonaws.com. IN  A
    
    ;; ANSWER SECTION:
    test8765.s3.amazonaws.com. 2016 IN  CNAME   s3-us-west-2-w.amazonaws.com.
    s3-us-west-2-w.amazonaws.com. 5 IN  A   52.218.216.10
    
    ;; Query time: 16 msec
    ;; SERVER: 127.0.0.53#53(127.0.0.53)
    ;; WHEN: Thu Jan 03 15:16:11 AEDT 2019
    ;; MSG SIZE  rcvd: 99
    
    bing@bingstp:~$ aws s3api create-bucket --bucket test8765
    
    An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The unspecified location constraint is incompatible for the region specific endpoint this request was sent to.
    bing@bingstp:~$ aws s3api create-bucket --bucket test8765 --create-bucket-configuration LocationConstraint=eu-west-1
    
    An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The eu-west-1 location constraint is incompatible for the region specific endpoint this request was sent to.
    bing@bingstp:~$ aws s3api create-bucket --bucket test8765 --create-bucket-configuration LocationConstraint=us-west-2
    
    An error occurred (BucketAlreadyExists) when calling the CreateBucket operation: The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again.
    bing@bingstp:~$ aws s3api create-bucket --bucket test8765 --create-bucket-configuration LocationConstraint=us-west-1
    
    An error occurred (IllegalLocationConstraintException) when calling the CreateBucket operation: The us-west-1 location constraint is incompatible for the region specific endpoint this request was sent to.
    bing@bingstp:~$ 
    

    【讨论】:

      【解决方案5】:

      上面列出的大多数建议可能是导致IllegalLocationConstraintException 错误发生的原因。 就我而言,同样的错误发生并通过创建一个与我正在使用的代码具有相同区域的新存储桶来解决。 例如,如果在 us-east-1 区域中创建 S3 存储桶,则您的代码(例如,AWS SageMaker notebook instance)也必须从 us-east-1 区域创建。

      【讨论】:

        【解决方案6】:

        试试这个:

        aws s3api create-bucket --bucket myhosted-cctestdemowebsitetest.com --acl public-read --create-bucket-configuration LocationConstraint=ap-south-1 --region ap-south-1
        

        【讨论】:

          【解决方案7】:

          我也面临同样的问题。更改存储桶名称并尝试。它对我有用。

          【讨论】:

            猜你喜欢
            • 2022-09-24
            • 1970-01-01
            • 2023-02-24
            • 2021-06-13
            • 2020-07-01
            • 2018-12-12
            • 1970-01-01
            • 1970-01-01
            • 2014-06-03
            相关资源
            最近更新 更多