AWS S3 Commands
General
$aws s3 help
$aws s3 ls
$aws s3 ls s3://bucket-name
Working with files
$aws s3 cp file.txt s3://my-bucket/
$aws s3 rm s3://my-bucket/path/MyFile2.rtf
Sync
$aws s3 sync . s3://my-bucket/path
Sync + delete
The following example, which extends the previous one, shows how this works.
Delete local file
$rm ./MyFile1.txt
Attempt sync without --delete option - nothing happens
$aws s3 sync . s3://my-bucket/path
Sync with deletion - object is deleted from bucket
$ aws s3 sync . s3://my-bucket/path --delete
(delete: s3://my-bucket/path/MyFile1.txt)
Delete object from bucket
$aws s3 rm s3://my-bucket/path/MySubdirectory/MyFile3.txt
(delete: s3://my-bucket/path/MySubdirectory/MyFile3.txt)
Sync with deletion - local file is deleted
$aws s3 sync s3://my-bucket/path . --delete
(delete: MySubdirectory\MyFile3.txt)
Sync with Infrequent Access storage class
$aws s3 sync . s3://my-bucket/path --storage-class STANDARD_IA
References
Common CLI Commands & Reference
s3 – High-level commands that simplify performing common tasks, such as creating, manipulating, and deleting objects and buckets. S3 Reference
s3api – Exposes direct access to all Amazon S3 API operations which enables you to carry out advanced operations. S3API Reference