AWS CLI S3 Command FAQ

Q: How to copy all files in the current directory to a remote S3 directory?

A:

aws s3 cp ./ s3://bucket/p/a/t/h/ --recursive

You can optionally exclude files in the current foler (i.e. to exclude all zip files):

aws s3 cp ./ s3://bucket/p/a/t/h/ --recursive --exclude *.zip

Q: How to delete a “folder” recursively?

A:

aws s3 rm s3://bucket/p/a/t/h/ --recursive --dryrun

and once you are happy with what will be deleted, run without --dryrun flag.


To contact me, send an email anytime or leave a comment below.