Interview Prep/AWS/IAM Advanced, STS and Multi-Account

How do you set up SSO-based CLI access?

BeginnerConceptIAM Advanced, STS and Multi-Account
Answer

Configure an SSO profile once, then log in to get cached short-lived credentials.

aws configure sso          # prompts for start URL, region, account, permission set
aws sso login --profile prod-admin
aws s3 ls --profile prod-admin

Profiles live in ~/.aws/config as sso_session, sso_account_id and sso_role_name. No access keys are stored on disk, and aws sso logout clears the cache.

aws All AWS questions Roadmap: AWS core services

More on IAM Advanced, STS and Multi-Account