Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS CLI delete S3 non-empty bucket

I am trying to delete an Amazon S3 bucket that is not empty.

this docs says I can delete using the following command

$ aws s3 rb s3://bucket-name --force  

and to delete non empty I need to add --force flag which is not working.

Here is my command to delete the bucket, any clue why force flag wont work?

aws s3 rb s3://<bucket_name> --force --profile <profile_name>

Update:

I have tried following docs to empty the bucket but I don't see any output in the console:

$ aws s3 rm s3://bucket-name --recursive

like image 703
hafiz ali Avatar asked Dec 16 '25 12:12

hafiz ali


1 Answers

You may try first to empty the bucket recursivelly and then delete it using rb command.

aws s3 rm s3://bucket-name --recursive
aws s3 rb s3://bucket-name --force  
like image 102
AnMi Avatar answered Dec 19 '25 06:12

AnMi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!