简体   繁体   English

aws s3api create-bucket —bucket 异常

[英]aws s3api create-bucket —bucket make exception

I am trying to create an S3 bucket using我正在尝试使用创建一个 S3 存储桶

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

It gives this error:它给出了这个错误:

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.

I set the region using aws configure to eu-west-1我使用aws configure将区域设置为eu-west-1

Default region name [eu-west-1]: 

but it gives the same error.但它给出了同样的错误。 How do I solve this?我该如何解决这个问题?

I use osx terminal to connect aws我使用osx终端连接aws

try this:尝试这个:

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

Regions outside of us-east-1 require the appropriate LocationConstraint to be specified in order to create the bucket in the desired region. us-east-1之外的区域需要指定适当的LocationConstraint才能在所需区域中创建存储桶。

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

Using mb solved the issue for us使用 mb 为我们解决了这个问题

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

You'll also get this error if you're trying to create a bucket with a name that's already been taken.如果您尝试创建一个名称已被使用的存储桶,您也会收到此错误。

So try giving your bucket a more unique name and then it should work (I just added digits to the end of the bucket name).因此,尝试为您的存储桶提供一个更独特的名称,然后它应该可以工作(我只是在存储桶名称的末尾添加了数字)。

I have seen many answers like the first one about "LocationConstraint".我看过很多答案,比如关于“LocationConstraint”的第一个答案。 The answer is correct, but only covers half the case.答案是正确的,但只涵盖了一半的情况。 I tried to include "LocationConstraint" to solve the problem but still got the same error.我尝试包含“LocationConstraint”来解决问题,但仍然遇到相同的错误。 It's Omar Zairi's second answer gave me a clue.这是 Omar Zairi 的第二个答案给了我一个线索。

The message here is in fact very confusing.这里的信息实际上非常混乱。 When you are trying to create a bucket with a name that's already taken, only when your configured region is the same as the bucket with the already taken name's region, you receive the message "The requested bucket name is not available".当您尝试创建名称已被占用的存储桶时,仅当您配置的区域与已占用名称的存储桶的区域相同时,您才会收到消息“请求的存储桶名称不可用”。 Otherwise, you receive "location constraint is incompatible for the region specific endpoint this request was sent to".否则,您会收到“位置约束与此请求发送到的区域特定端点不兼容”。

To find if a name is already taken, and in case it's taken, which region the bucket with that name is in, look at the DNS record of "the-name.s3.amazonaws.com".要查找名称是否已被占用,如果已被占用,具有该名称的存储桶位于哪个区域,请查看“the-name.s3.amazonaws.com”的 DNS 记录。

Below I use a taken name "test8765" to show what I mentioned above.下面我使用一个取名“test8765”来显示我上面提到的内容。 Hope this helps whoever got confused like I did.希望这可以帮助像我一样困惑的人。

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:~$ 

Most of the suggestions listed above could be a reason for the IllegalLocationConstraintException error to happen.上面列出的大多数建议可能是IllegalLocationConstraintException错误发生的原因。 In my case, the same error happened and solved by creating a new bucket with the same region as that of the code I am working with.就我而言,通过创建一个与我正在使用的代码具有相同区域的新存储桶,发生并解决了相同的错误。 For instance, if S3 bucket is created in us-east-1 region, your code eg, the AWS SageMaker notebook instance has to be also created from us-east-1 region.例如,如果S3 存储桶是在us-east-1区域中创建的,则您的代码(例如AWS SageMaker notebook instance也必须从us-east-1区域中创建。

试试这个:

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

I got this error when using:使用时出现此错误:

aws s3 mb s3:// --region us-east-1 aws s3 mb s3:// --region us-east-1

Adding numbers to the bucket name fixed it for me.在存储桶名称中添加数字为我修复了它。

s3.create_bucket(Bucket=bucket_name,CreateBucketConfiguration={'LocationConstraint':'us-west-2'}) s3.create_bucket(Bucket=bucket_name,CreateBucketConfiguration={'LocationConstraint':'us-west-2'})

if your location is not 'us-east-1' you must use CreateBucketConfiguration={'LocationConstraint':'your location'} inside create_bucket().如果您的位置不是“us-east-1”,则必须在 create_bucket() 中使用 CreateBucketConfiguration={'LocationConstraint':'your location'}。 The right syntax is mentioned above.上面提到了正确的语法。

Even I'm facing the same problem.即使我面临同样的问题。 Change the bucket name and try.更改存储桶名称并尝试。 It worked for me它对我有用

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

相关问题 AWS cli s3api put-bucket-tagging - 除非存储桶有 0 个标签,否则无法将标签添加到存储桶 - AWS cli s3api put-bucket-tagging - cannot add tag to bucket unless bucket has 0 tags 如何使用 aws s3api 将 acl 策略应用于 S3 存储桶中的子文件夹 - How to apply acl policies using aws s3api to subfolders in S3 bucket 参数验证失败:aws s3api put-object-acl 中的存储桶名称无效 - Parameter validation failed: Invalid bucket name in aws s3api put-object-acl aws s3api put-bucket-website - PutBucketWebsite 操作:访问被拒绝 - aws s3api put-bucket-website - PutBucketWebsite operation: Access Denied AWS cli s3api put-bucket-tagging 无法识别我的 TagSet - AWS cli s3api put-bucket-tagging not recognizing my TagSet 对于us-east-1存储桶,s3api get-bucket-location返回null - s3api get-bucket-location returns null for us-east-1 bucket 如何使用 S3API 或任何其他实用程序在 S3 Bucket 中查找“仅文件夹”? - How to find "folder only" in S3 Bucket using S3API or any other utils? s3api put-bucket-notification-configuration删除现有事件 - s3api put-bucket-notification-configuration deletes existing events 为什么在使用 s3api 获取存储桶 ACL 时缺少“DisplayName”? - Why is the "DisplayName" missing when getting the bucket ACL using s3api? AWS API创建s3存储桶并在s3存储桶中添加上传文件 - AWS API to create s3 bucket and add upload file in s3 bucket
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM