S3 CLI Commands

CommandOptionDescriptionUsageVariables
lsList all bucketsaws s3 ls
List all objects in a specific bucketaws s3 ls s3://bucketnamebucketname
--recursivelist all objects under a bucket recursivelyaws s3 ls s3://bucketname --recursivebucketname
--summarizelist objects as well as show summaryaws s3 ls s3://bucketname --recursive --summarizebucketname
--human-readablelist size of objects with unitsaws s3 ls s3://bucketname --recursive --summarize --human-readablebucketname
mbcreate bucket in the default regionaws s3 mb s3://bucketnamebucketname
--regioncreate bucket in the specified regionaws s3 mb s3://bucketname --region regionnamebucketname
regionname
rbremove empty bucket aws s3 rb s3://bucketnamebucketname
--forceremove bucket and unversioned objectsaws s3 rb s3://bucketname --forcebucketname
rmaws s3 rm s3://bucketname/objectnamebucketname
--recursiveaws s3 rm s3://bucketname/ --recursivebucketname
--excludeaws 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.htmlindex.html
error.html
cpaws 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
mvaws 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
--excludeaws s3 mv s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*"
bucketname1, bucketname2, pattern
--includeaws 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
syncaws 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
--excludeaws s3 sync s3://bucketname1/ s3://bucketname2/ --exclude "*pattern*"
bucketname1, bucketname2, pattern
--includeaws 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