1

I need to delete my s3 bucket

Versioning is disabled as the version id for each file is set to null.

When I enter

aws s3 rb s3://bucketname --force

It ends with the following output

remove_bucket failed: s3://bucketname An error occurred (BucketNotEmpty) when calling the DeleteBucket operation: The bucket you tried to delete is not empty. You must delete all versions in the bucket.

How can I permanently delete the bucket and its via the AWS CLI?

I have tried these solutions as well and they didn't work either: https://stackoverflow.com/a/41399166/11983010

https://stackoverflow.com/a/35306665/11983010

Bob
  • 357
  • 1
  • 3
  • 14

1 Answers1

0

If you have versioning enabled that won't be possible

You can delete a bucket that contains objects using the AWS CLI only if the bucket does not have versioning enabled. If your bucket does not have versioning enabled, you can use the rb (remove bucket) AWS CLI command with --force parameter to remove a non-empty bucket. This command deletes all objects first and then deletes the bucket.

Try disabling versioning.

Alternatively recursively delete all objects in the S3 bucket first by running the following

aws s3 rm s3://bucket-name --recursive
Chris Williams
  • 32,215
  • 4
  • 30
  • 68