简体   繁体   中英

AWS s3 rb doesn't work in the CLI, how do I delete files in my s3 bucket?

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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