AWS CLI 2 cheatsheet

AWS CLI 2: Setup and credentials

8 common AWS CLI 2 tasks.

Check the CLI version

Print the installed AWS CLI version.

aws --version

Configure credentials

Set your access key, secret key, default region and output format interactively.

aws configure

Configure a named profile

Store a second set of settings under a profile name.

aws configure --profile dev

Set up IAM Identity Center

Create a profile that signs in with single sign-on instead of long-lived keys.

aws configure sso

Sign in with SSO

Open the browser to refresh your SSO session.

aws sso login --profile dev

Check who you are

Show the account and identity the CLI is using. The first thing to check when something is denied.

aws sts get-caller-identity

Use a profile for the session

Make every command in this shell use a profile.

export AWS_PROFILE=dev

See where settings come from

Show the active settings and their sources.

aws configure list

Was this page helpful?