Aws s3 Cli Cheat Sheet
Aws s3 Cli Cheat Sheet
https://www.linkedin.com/in/atul-v-mistry/
Copying a local file to S3 with an expiration date Recursively copying S3 objects to a local directory Granting permissions for an S3 object
aws s3 cp file.txt s3://mybucket/ --grants
aws s3 cp test.txt s3://mybucket/test2.txt --
aws s3 cp s3://mybucket . --recursive read=uri=http://acs.amazonaws.com/groups/global/A
expires 2014-10-01T20:30:00Z llUsers [email protected]
Copying a file from S3 to S3 Recursively copying local files to S3 Uploading a local file stream to S3
aws s3 cp s3://mybucket/test.txt aws s3 cp myDir s3://mybucket/ --recursive --
aws s3 cp - s3://mybucket/stream.txt
s3://mybucket/test2.txt exclude "*.jpg"
Copying an S3 object to a local file Recursively copying S3 objects to another bucket Downloading an S3 object as a local file stream
aws s3 cp s3://mybucket/ s3://mybucket2/ --
aws s3 cp s3://mybucket/test.txt test2.txt aws s3 cp s3://mybucket/stream.txt -
recursive --exclude "another/*"
Recursively moves all files but exclude some file with Grant read access to all users and full control to a specific
Moves a single object to a specified file locally
specific extension user identified by their email address.
aws s3 mv file.txt s3://mybucket/ --grants
aws s3 mv myDir s3://mybucket/ --recursive --
aws s3 mv s3://mybucket/test.txt test2.txt read=uri=http://acs.amazonaws.com/groups/global/A
exclude "*.jpg"
llUsers [email protected]
Recursively moves all files but exclude some file with Grant read access to all users and full control to a specific
Moves a single object to a specified file locally
specific extension user identified by their email address.
aws s3 mv file.txt s3://mybucket/ --grants
aws s3 mv myDir s3://mybucket/ --recursive --
aws s3 mv s3://mybucket/test.txt test2.txt read=uri=http://acs.amazonaws.com/groups/global/A
exclude "*.jpg"
llUsers [email protected]
mb - Create an S3 buckets presign - To generate presign URL for S3 Object rb - To delete an empty S3 bucket
To create a pre-signed URL with the default one hour
Creates a bucket Remove a bucket
lifetime that links to an object in an S3 bucket
aws s3 mb s3://mybucket aws s3 presign s3://awsexamplebucket/test2.txt aws s3 rb s3://mybucket
To create a pre-signed URL with a custom lifetime that Remove all of the objects in the bucket and then remove
Creates a bucket in a region
links to an object in an S3 bucket the bucket itself.
aws s3 presign s3://awsexamplebucket/test2.txt --
aws s3 mb s3://mybucket --region us-west-1 aws s3 rb s3://mybucket --force
expires-in 604800
Deletes all objects but excluding some objects with prefix Deletes all objects but excluding some objects
aws s3 rm s3://mybucket/ --recursive --exclude "another/*" aws s3 rm s3://mybucket/ --recursive --exclude "*.jpg"
Syncs objects under a specified prefix and bucket to files Syncs objects from S3 bucket to local directory but Syncs objects from S3 bucket to local directory but
in a local directory by uploading the local files to s3 exclude objects with specific extension exclude specific directory for sync
aws s3 sync . s3://mybucket --delete aws s3 sync . s3://mybucket --exclude "*.jpg" aws s3 sync s3://mybucket/ . --exclude "*another/*"