LazyCodet

a

14:29:59 25/4/2024 - 3 views -
Programming

AWS CLI - Full

AWS configure

We must configure the access key and secret key of the bucket by the command:

aws configure

​List all buckets

​To list all the buckets

aws --endpoint-url=https://123456789.r2.cloudflarestorage.com s3 ls 
  • https://123456789.r2.cloudflarestorage.com: This is my endpoint
    • 123456789: This is my Account ID because I use Cloudflare R2

​Run command without type --endpoint

​You can see that with each command we run it that always has --endpoint-url, it's so long for the command. You can define it using default --endpoint-url like this:

alias aws = aws -- endpoint-url=<you_url>

You can watch this video: Set default endpoint AWS CLI

​Upload files, folders to the bucket

To upload multiple files, folders 

aws s3 cp SOURCE_DIR s3://DEST_BUCKET/ --recursive

If you want to upload all the folders, and files in the current path, you can replace SOURCE_DIR as dot (.)

​References

​https://stackoverflow.com/questions/5123208/upload-folder-with-subfolders-using-s3-and-the-aws-console