aws s3api create-bucket -bucket make exception

时间:2018-03-08 13:47:06

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

我尝试使用

创建s3存储桶

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

发生此错误

  

调用时发生错误(IllegalLocationConstraintException)   CreateBucket操作:未指定的位置约束是   与此区域特定端点不兼容此请求已发送   到。

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

Default region name [eu-west-1]: 

但是犯了同样的错误。我是怎么解决的。

我使用osx终端连接aws

5 个答案:

答案 0 :(得分:14)

试试这个:

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

答案 1 :(得分:3)

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

因此,请为您的存储桶指定一个更唯一的名称,然后它应该可以工作(我只是在存储桶名称的末尾添加了数字)。

答案 2 :(得分:3)

使用mb为我们解决了这个问题

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

答案 3 :(得分:1)

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

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

要查找名称是否已被使用(如果已被使用),以及具有该名称的存储桶所在的区域,请查看DNS记录“ the-name.s3.amazonaws.com”。

在下面,我使用名称“ 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:~$ 

答案 4 :(得分:1)

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