WB
Home About Work Notes

AWS CLI For People Used to Better Things Cheatsheet

  19th May 2022
  30 seconds
  Hosting

You probably have access to a bunch of aws accounts, because you are a working stiff that supports everybodies silly aws hosted websites. No probs, have multiple profiles

List profiles: aws configure list-profiles

To add one, edit ~/.aws/credentials Add each profile like this:

[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
[user1]
aws_access_key_id=AKIAI44QH8DHBEXAMPLE
aws_secret_access_key=je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY

Edit the ~/.aws/config file:

[profile user1]
region=us-east-1
output=text

To use the profile, just add --profile user1 to a command.

Sync Bucket to local (take a backup)

aws s3 sync s3://ya-bucket ./ya-bucket-bk --profile profile-name

To upload stuff, reverse the order of the locations, ie:

aws s3 sync ./ya-bucket-bk s3://ya-bucket --profile profile-name

Lets make something together!

Get in touch at [email protected]


Copyright 2024 © All rights Reserved.
Crafted Web Development. Built With