S3

List Buckets

aws s3 ls
2020-01-28 18:49:50 customer-data-primary
2020-01-28 18:50:22 customer-data-backup
2020-01-28 18:50:54 wordpress-cdn
2020-01-28 18:52:25 backend-artifacts-20200220-deployment

List Files in a Bucket

aws s3 ls wordpress-cdn/wp-content/uploads/2019/10/04/
2019-10-04 15:02:02     133557 amazing-content.jpg
2019-10-04 15:02:02       2986 amazing-content-103x50.jpg
2019-10-04 15:02:02       5640 amazing-content-120x120.jpg
2019-10-04 15:02:02       7924 amazing-content-150x150.jpg

Create a Bucket

aws s3 mb s3://my-awesome-new-bucket
make_bucket: my-awesome-new-bucket

Delete a Bucket

aws s3 rb s3://my-awesome-new-bucket --force

Download an S3 Object to Local

aws s3 cp s3://my-awesome-new-bucket .
download: ./backup.tar from s3://my-awesome-new-bucket/backup.tar

Upload Local File as a S3 Object

aws s3 cp backup.tar s3://my-awesome-new-bucket
upload: ./backup.tar to s3://my-awesome-new-bucket/backup.tar

Delete an S3 Object

aws s3 rm s3://my-awesome-new-bucket/secret-file.gz
delete: s3://my-awesome-new-bucket/secret-file.gz

Download Bucket to Local

aws s3 sync s3://my-awesome-new-bucket/ /media/Passport-Ultra/Backup

Upload Local Directory to Bucket

aws s3 sync /home/minhaz/Downloads s3://my-awesome-new-bucket/

Share S3 Object without Presigned URL

aws s3 presign s3://my-awesome-new-bucket/business-reports.pdf --expires-in 3600
https://my-awesome-new-bucket.s3.amazonaws.com/business-reports.pdf?AWSAccessKeyId=AKISUENSAKSIEUAA&Expires=1582876994&Signature=kizOEA93kaIHw7uv25wSFIKLmAx