AWS Cheatsheet

S3 - Simple Storage Service Commands

Task Command

List S3 buckets

aws s3 ls

List the contents of an S3 bucket

aws s3 ls s3://<bucket-name>

Create a new bucket

aws s3 mb s3://<bucket-name>

Remove a bucket (must be empty)

aws s3 rb s3://<bucket-name>

Sync local object to a bucket

aws s3 sync <local> s3://<bucket-name>

Copy a local object to a bucket

aws s3 cp <local> s3://<bucket-name>

Copy from a bucket

aws s3 cp s3://<bucket-name><object> <local-destination>

Move an object

aws s3 mv s3://<bucket-name><object> <local-name>

Remove or delete an object

aws s3 rm s3://<bucket-name><object>

Empty a bucket of all objects

aws s3 rm s3://<bucket-name> --recursive

Sync objects local to bucket

aws s3 sync s3://<bucket-name><object>

Copy all objects bucket to bucket

aws s3 cp s3://<source-bucket> s3://<destination-bucket

Common options

  • --profile boto profile e.g. --profile aws-production

Tony Kay avatar
About Tony Kay
Team lead for Automation and Management in Red Hat's GPTE DevOps and Automation team. Working globally, I focus primarily on Hybrid Cloud Automation with Ansible. About 2/3rds of my time is automating production cloud deployments and developing both code and training content. I also deliver Automation training globally to both Red Hat and Partner Consultants and Architects on cloud infrastructure using Ansible and on OpenShift/Kubernetes.
comments powered by Disqus