Command | Option | Description | Usage | Variables |
---|---|---|---|---|
ls | List all buckets | aws s3 ls | ||
List all objects in a specific bucket | aws s3 ls s3://bucketname | bucketname | ||
--recursive | list all objects under a bucket recursively | aws s3 ls s3://bucketname --recursive | bucketname | |
--summarize | list objects as well as show summary | aws s3 ls s3://bucketname --recursive --summarize | bucketname | |
--human-readable | list size of objects with units | aws s3 ls s3://bucketname --recursive --summarize --human-readable | bucketname | |
mb | create bucket in the default region | aws s3 mb s3://bucketname | bucketname | |
--region | create bucket in the specified region | aws s3 mb s3://bucketname --region regionname | bucketname regionname |
|
rb | remove empty bucket | aws s3 rb s3://bucketname | bucketname | |
--force | remove bucket and unversioned objects | aws s3 rb s3://bucketname --force | bucketname | |
rm | aws s3 rm s3://bucketname/objectname | bucketname | ||
--recursive | aws s3 rm s3://bucketname/ --recursive | bucketname | ||
--exclude | aws s3 rm s3://bucketname/ --recursive --exclude "pattern" | bucketname pattern |
||
website | --index-document --error-document | aws s3 website s3://bucketname/ --index-document index.html --error-document error.html | index.html error.html |
|
cp | aws s3 cp s3://bucketname/objectname /local/path/ | bucketname, objectname, local path |
||
aws s3 cp s3://bucketname1/objectname s3://bucketname2/objectname | bucketname1, bucketname2, objectname |
|||
aws s3 cp /loal/path/filename s3://bucketname/objectname | local path, filename, bucketname, objectname |
|||
--exclude | aws s3 cp s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" | bucketname1, bucketname2, pattern |
||
--include | aws s3 cp s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" --include "*pattern*" | bucketname1, bucketname2, pattern |
||
--source-region --region | aws s3 cp s3://bucketname1/ s3://bucketname2/ --source-region us-east-1 --region eu-west-1 | bucketname1, bucketname2, reg1, reg2 |
||
mv | aws s3 mv s3://bucketname/objectname /local/path/ | bucketname, objectname, local path |
||
aws s3 mv s3://bucketname1/objectname s3://bucketname2/objectname | bucketname1, bucketname2, objectname |
|||
aws s3 mv /local/path/filename s3://bucketname/objectname | local path, filename, bucketname, objectname |
|||
--exclude | aws s3 mv s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" | bucketname1, bucketname2, pattern |
||
--include | aws s3 mv s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" --include "*pattern*" | bucketname1, bucketname2, pattern |
||
--source-region --region | aws s3 mv s3://bucketname1/ s3://bucketname2/ --source-region reg1 --region reg2 | bucketname1, bucketname2, reg1, reg2 |
||
sync | aws s3 sync s3://bucketname/ /local/path/ | bucketname, objectname, local path |
||
aws s3 sync s3://bucketname1/ s3://bucketname2/ | bucketname1, bucketname2, objectname |
|||
aws s3 sync /loal/path/ s3://bucketname/ | local path, filename, bucketname, objectname |
|||
--exclude | aws s3 sync s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" | bucketname1, bucketname2, pattern |
||
--include | aws s3 sync s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*" --include "*pattern*" | bucketname1, bucketname2, pattern |
||
--source-region --region | aws s3 sync s3://bucketname1/ s3://bucketname2/ --source-region us-east-1 --region eu-west-1 | bucketname1, bucketname2, reg1, reg2 |