AWS‎ > ‎

S3

command reference

quick command reference

user guide

commands
$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


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

Comments