Skip to content

S3 Bucket simultaneously exists and doesn't exist

1

Hello, I have the following list of S3 buckets, as shown by the command below:

$ aws s3 ls
2023-04-27 20:21:10 mys3nsbyt
2023-04-27 20:21:11 mys3oestl

Trying to delete these bucket I get:

$ aws s3api delete-bucket --bucket mys3nsbyt
An error occurred (NoSuchBucket) when calling the DeleteBucket operation: The specified bucket does not exist
$ aws s3api delete-bucket --bucket mys3oestl
An error occurred (NoSuchBucket) when calling the DeleteBucket operation: The specified bucket does not exist

How come that the buckets exist when listed and don't exist when trying to delete them ? And what am I supposed to do here ? For having googled for a while, I can see several times this issue to be reported, but no any pertinent solution, other than to wait 10 hours in order that it disappears by itself.

Many thanks in advance,

Nicolas

asked 3 years ago3.4K views
5 Answers
1

Hi

Generally, when you issue a delete API call to delete a S3 bucket, it will be sent to a bucket deletion queue and this queue will be processed and replicated across all regions. This is a completely automated process and it is not performed immediately and can take some time to replicate across all regions.

Until the bucket is removed by S3, you may see the bucket in the response of ListAllMyBuckets request due to S3 eventual consistency, however you cannot perform any other action on this bucket.

I would suggest you to wait up to 24 hours after the bucket deletion time and then check the S3 console.

AWS
answered 3 years ago
EXPERT
reviewed 2 years ago
  • You seem to find that normal to wait 24 hours such that an operation to terminate. Is that supposed to be a solution ?

0
Accepted Answer

The issue has disappeared by itself 24 hours later. That's crazy that people accept to leave with that !

answered 3 years ago
0

I suggest trying with the switch --region and pass where the bucket exists. If you do not specify the region I believe it uses your config/env settings. See if that makes a difference.

Also you could always enable debug --debug

EXPERT
answered 3 years ago
  • No difference given that an S3 bucket is global. And yes, of course I can enable debug, but what for ? Would that change anything ? In any case, the issue has disappeared 24 hours later.

0

Check the status of the bucket

aws s3api get-bucket-location --bucket mys3nsbyt

maybe The bucket has been locked by another user or the bucket is still in the process

EXPERT
answered 3 years ago
  • It cannot have been locked by another user given that I'm the only one. Anyway, the issue disappeared by itself 24 hours later. I hope I won't have to wait 24 hours each time I need to delete and recreate my stack !

0

This happened again:

 $ aws s3 ls
2023-06-02 17:23:33 mys3fwflw
$ aws s3 rb s3://mys3fwflw --force
fatal error: An error occurred (NoSuchBucket) when calling the ListObjectsV2 operation: The specified bucket does not exist

remove_bucket failed: Unable to delete all objects in the bucket, bucket will not be deleted.
$ aws s3api get-bucket-location --bucket mys3fwflw

An error occurred (NoSuchBucket) when calling the GetBucketLocation operation: The specified bucket does not exist

And of course, the AWS console doesn't show any bucket. So the bucket exists when getting the list but doesn't when trying to remove it or to get its status. It exists and doesn't exist in the same time LOL

answered 3 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.