AWS CLIv2 Cheat Sheet¶
Authentication¶
After creating an IAM user in the AWS console and creating an access key, configure the AWS CLI interactively with:
Show the signed-in user¶
CLI Version Details¶
Filtering and Querying¶
Enumerate Storage¶
Enumerate all buckets in an account:
Enumerate all objects or blobs in a bucket:
Uploading and Downloading Files from Storage¶
Uploading
Downloading
Key Management¶
Activate an access key id for an IAM user
Deactivate an access key id for an IAM user
Delete access key id and secret access key pair
Remote Administration¶
SSH to a Public Cloud VM
ssh ubuntu@$(aws ec2 describe-instances --filters Name=instance-state-name,Values=running Name=tag-value,Values=<INSTANCE_NAME> --query "Reservations[0].Instances[0].PublicIpAddress" --output text)
Encryption and Decryption¶
Encrypting data
aws kms encrypt --key-id <KEY_ARN_OR_ALIAS> --plaintext <TEXT> | jq -r '.CiphertextBlob' | base64 -d > encrypted.txt
Decrypting data
aws kms decrypt --key-id <KEY_ARN_OR_ALIAS> --ciphertext-blob fileb://encrypted.txt | jq -r '.Plaintext'