简体   繁体   English

AWS S3 存储桶不一致

[英]AWS S3 Bucket Inconsistency

When I list the buckets using the AWS CLI, I see a bunch of buckets.当我使用 AWS CLI 列出存储桶时,我看到一堆存储桶。 The same buckets are visible from the AWS S3 Management Console also.从 AWS S3 管理控制台也可以看到相同的存储桶。

But, when I try to remove the bucket from the CLI, it throws an error as shown below.但是,当我尝试从 CLI 中删除存储桶时,它会引发如下所示的错误。 There seems to be some inconstancy in the S3 state. S3 状态似乎有些不稳定。 Not able to delete them from the AWS S3 Management Console also.也无法从 AWS S3 管理控制台中删除它们。

Why is this happening and how to get around this?为什么会发生这种情况以及如何解决这个问题?

在此处输入图片说明

Due to the consistency model of S3, something you have to wait a few hours to delete a just created bucket.由于 S3 的一致性模型,您必须等待几个小时才能删除刚刚创建的存储桶。

In which region are you trying to do this?你想在哪个地区这样做?

This behavior relates to the fact that deleting an S3 bucket can cause static hosting issues.此行为与删除 S3 存储桶可能导致静态托管问题有关。

Let's say that you have a static S3 website (whose bucket name has to be the same as the domain name), say www.example.com .假设您有一个静态 S3 网站(其存储桶名称必须与域名相同),例如www.example.com If you delete the www.example.com S3 bucket and then someone else in another account happens to create a bucket with that same name then you have lost the bucket name and consequently you have lost the ability to host an S3 static website with your own domain name www.example.com .如果您删除了www.example.com S3 存储桶,然后另一个账户中的其他人碰巧创建了一个具有相同名称的存储桶,那么您将丢失存储桶名称,因此您将无法使用自己的方式托管 S3 静态网站域名www.example.com

So, AWS gives you a grace period after deleting an S3 bucket.因此,AWS 会在删除 S3 存储桶后为您提供宽限期。 During this grace period, only your account can create an S3 bucket with the same name (and it has to be in the same AWS region).在此宽限期内,只有您的账户可以创建同名的 S3 存储桶(并且必须在同一 AWS 区域中)。 The grace period is typically of the order of a few hours.宽限期通常是几个小时的数量级。

If you intend to re-use an S3 bucket, the best advice is not to delete it, but to simply delete its contents.如果您打算重复使用 S3 存储桶,最好的建议是不要删除它,而只需删除其内容即可。

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

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