AWS CLI S3 Cheatsheet
It's much faster to interface with S3 files through the CLI than it is to use the web browser. Here is a cheatsheet of useful S3 based CLI commands. In order to use these commands, you will need to have configured your AWS settings for authorization.
Remove All Files In A Bucket
aws s3 rm --recursive s3://my-bucket
* character as a wildcard. S3 considers this a valid character for a filename. Hence the use of the
Copy A Bucket
aws s3 cp --recursive \ s3://my-bucket \ s3://my-second-bucket
Move A Bucket's Contents
Same as before but with "mv" instead of "cp"
Upload To Bucket
aws s3 cp \ /path/to/local/file.txt \ s3://my-bucket/sub-folder/file.txt
Download File From Bucket
aws s3 cp \ s3://my-bucket/sub-folder/file.txt \ /path/to/local/file.txt
First published: 24th March 2020