AWS Tutorials: AWS S3 Commands Example

List Buckets: To list all your S3 buckets.
aws s3 ls

List Objects in a Bucket: To list all objects in a specific bucket.
aws s3 ls s3://[bucket-name]/

Create a New Bucket: To create a new S3 bucket.
aws s3 mb s3://[bucket-name]

Delete a Bucket: To delete an S3 bucket. The bucket must be empty before it can be deleted.
aws s3 rb s3://[bucket-name]

Upload File to Bucket: To upload a file to an S3 bucket.
aws s3 cp [file-name] s3://[bucket-name]/[destination-path]

Download File from Bucket: To download a file from an S3 bucket.
aws s3 cp s3://[bucket-name]/[file-name] [local-destination-path]

Delete File from Bucket: To delete a file from an S3 bucket.
aws s3 rm s3://[bucket-name]/[file-name]

Sync Local Directory with Bucket: To synchronize the contents of a local directory with an S3 bucket.
aws s3 sync [local-directory-path] s3://[bucket-name]

Sync Bucket with Local Directory: To synchronize the contents of an S3 bucket with a local directory.
aws s3 sync s3://[bucket-name] [local-directory-path]

Move File: To move a file from one S3 location to another.
aws s3 mv s3://[bucket-name]/[source-file-name] s3://[bucket-name]/[destination-file-name]
Rajesh Kumar
Follow me
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x