AWS CLI

Install AWS CLI

$ curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" 
$ sudo installer -pkg AWSCLIV2.pkg -target /
$ which aws /usr/local/bin/aws
$ aws --version aws-cli/2.4.5 Python/3.8.8 Darwin/18.7.0 botocore/2.4.5

Configure AWS CLI

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: json
$ aws sts get-caller-identity

Working with S3 buckets

$ aws s3 ls
--recursive
aws s3 cp s3://s3-bucket-name/ LocalFolder --recursive

Assuming Roles

aws sts assume-role --role-arn "arn:aws:iam::12345678910:role/RoleName" --role-session-name GiveItAnyName-session
{
"Credentials": {
"AccessKeyId": "Some String",
"SecretAccessKey": "Longer String",
"SessionToken": "A ver long string...",
"Expiration": "Some date+time"
},
"AssumedRoleUser": {
"AssumedRoleId": "Some String",
"Arn": "arn:aws:sts::ARN-number and role etc."
}
}
export AWS_ACCESS_KEY_ID="Some String"
export AWS_SECRET_ACCESS_KEY="Longer String"
export AWS_SESSION_TOKEN="A ver long string..."
$ aws sts get-caller-identity
$ unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN
$ aws sts get-caller-identity

Working with AWS Logs

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store