Published on

Set up AWS CLI SSO login

Authors
  • avatar
    Name
    Gene Zhang
    Twitter

Steps to configure the AWS CLI to retrieve credentials automatically using the aws configure sso.

  1. Add a new profile to the ~/.aws/config file:
[profile dev]
sso_start_url = https://xxx.awsapps.com/start
sso_region = us-west-2
sso_account_id = <your_account_id>
sso_role_name = <your_role_name>
region = us-west-2
output = json
  1. SSO login with the profile:
aws sso login --profile dev
  1. Run commands with --profile:
aws s3 ls --profile workload-dev

or set the profile as an environment variable:

export AWS_PROFILE=dev
aws s3 ls