Reputation: 33495
When I list the buckets using the AWS CLI, I see a bunch of buckets. The same buckets are visible from the AWS S3 Management Console also.
But, when I try to remove the bucket from the CLI, it throws an error as shown below. There seems to be some inconstancy in the S3 state. Not able to delete them from the AWS S3 Management Console also.
Why is this happening and how to get around this?
Upvotes: 2
Views: 332
Reputation: 78613
This behavior relates to the fact that deleting an S3 bucket can cause static hosting issues.
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
. 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
.
So, AWS gives you a grace period after deleting an S3 bucket. 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). 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.
Upvotes: 1
Reputation: 912
Due to the consistency model of S3, something you have to wait a few hours to delete a just created bucket.
In which region are you trying to do this?
Upvotes: 1