amazon – What are the rules for AWS rm bucket deleting?

Question:

If I write:

& aws s3 rm s3://bucket-name/folder/ 

It does not delete, it says that folder is not an object. If I write:

& aws s3 rm s3://bucket-name/folder/ --recursive

Then it deletes, and everything is fine, but what happens if I write:

& aws s3 rm s3://bucket-name/

I pose this question because I accidentally entered this command and then immediately clicked cancel. Did he delete some of my data in this gap or not?

Answer:

from the documentation :


The following rm command recursively deletes all objects under a specified bucket and prefix when passed with the parameter –recursive . In this example, the bucket mybucket contains the objects test1.txt and test2.txt:

aws s3 rm s3://mybucket --recursive

Output:

delete: s3://mybucket/test1.txt
delete: s3://mybucket/test2.txt

keywords are highlighted. those. without the --recursive option, nothing will be removed.

what is also important: the bucket itself will not be deleted either, even if the --recursive option is --recursive .

Scroll to Top