I have an S3 bucket that is 100% empty. Versioning was never enabled on the bucket. However, I still cannot remove the bucket. I have tried via the Console and the CLI tool. On the console it just says "Error" with no error message. From the cli and api it tells me: "An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty". I have tried all of the following:
aws s3 rb s3://<bucket_name> --force
-> BucketNotEmpty
aws s3 rm s3://<bucket_name> --recursive
-> No output (because it's already empty)
aws s3api list-object-versions --bucket <bucket_name>
-> No output (because versioning was never enabled)
aws s3api list-multipart-uploads --bucket <bucket_name>
-> No outputs
aws s3api list-objects --delimiter=/ --prefix= --bucket <bucket_name>
-> No Output (because it's empty)
I was facing this same problem. I was able to fix the issue by going into the bucket and deleting the "Bucket Policy" for the bucket. After that, deleting the bucket worked correctly.
I did this through the AWS console, for an S3 bucket created by Elastic Beanstalk (ie elasticbeanstalk-us-west-2-861587641234). I imagine the creation script includes a policy to prevent people from accidentally deleting the bucket.