CSCv0.10rz
GitHub

AWS S3 Basics

Quick reference for common AWS S3 CLI commands.

Bucket Operations Create a Bucket
aws s3 mb s3://your-bucket-name
List Buckets
aws s3 ls
Delete a Bucket

The bucket must be empty first.

aws s3 rb s3://your-bucket-name
Delete a Non-Empty Bucket

Use --force to delete the bucket and all its contents.

aws s3 rb s3://your-bucket-name --force
Object Operations Upload a File
aws s3 cp local-file.txt s3://your-bucket-name/remote-file.txt
Download a File
aws s3 cp s3://your-bucket-name/remote-file.txt local-file.txt
List Objects in a Bucket
aws s3 ls s3://your-bucket-name
Delete an Object
aws s3 rm s3://your-bucket-name/remote-file.txt
Sync a Local Directory to a Bucket
aws s3 sync . s3://your-bucket-name/
Sync a Bucket to a Local Directory
aws s3 sync s3://your-bucket-name/ .