Earlier, I explained how to install AWS CLI v2 on Raspberry Pi, today I’ll try and show how to use the aws cli to get things done. Most of my work is done with S3.
Official documentation
First of all, this post is for me, and for things I do a lot, if you’re trying to figure out if aws-cli is for you or not, checkout the official documention for aws-cli .
Get help
Show all objects/buckets
1
2
| aws s3 ls
2021-05-26 17:12:20 my-unique-bucket-05262021
|
Show all objects in a bucket
1
2
| aws s3 ls my-unique-bucket-05262021
2021-07-16 11:49:32 3071344 ImageOptim.tbz2
|
Upload a local file up to s3
1
2
|
aws s3 cp ImageOptim.tbz2 s3://my-unique-bucket-05262021
|
Create a URL that someone can use to download said file
1
2
3
4
| aws s3 presign my-unique-bucket-05262021/ImageOptim.tbz2 --expires-in 1209600
https://my-unique-bucket-05262021.s3.us-east-2.amazonaws.com/ImageOptim.tbz2?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIA37X6RZC75PYB3VE3%2F20210716%2Fus-east-2%2Fs3%2Faws4_request&X-Amz-Date=20210716T171430Z&X-Amz-Expires=1209600&X-Amz-SignedHeaders=host&X-Amz-Signature=41006b3db22d4bb0ab7d5b7e47db4f57cd4a56bf83e558c4a330a88d1f46f2ba
|
You should be able to Download, if today is within two weeks of the day I issued this command.