Skip to content

Instantly share code, notes, and snippets.

@calid
Last active December 4, 2023 17:02
Show Gist options
  • Save calid/de05b21a99d0f3a3aa441e494ba7210e to your computer and use it in GitHub Desktop.
Save calid/de05b21a99d0f3a3aa441e494ba7210e to your computer and use it in GitHub Desktop.
aws sso profile configuration that works with cdk
# ~/.aws/config
# NOTE: I will still occasionally get an 'Unable to resolve AWS account to use'
# cdk error when my sso token expires. CDK does not currently seem to trigger
# an sso refresh, nor does it provide a meaningful error message. However this
# is easily fixed by running `aws sso login` manually to refresh the token
# See: https://github.com/aws/aws-cdk/issues/24744
[sso-session my_session]
sso_start_url = https://d-xxxxxxxxxx.awsapps.com/start
sso_region = us-east-1
# The default section is not strictly necessary, but it allows you to do
# `aws sso login` without needing to specify `--profile`. Login is account
# independent, so it's fine to have a generic login and then use account
# specific profiles per command
[default]
sso_session = my_session
[profile profile_a]
sso_session = my_session
sso_account_id = 01234
sso_role_name = MyRole
region = us-east-1
[profile profile_b]
sso_session = my_session
sso_account_id = 56789
sso_role_name = MyRole
region = us-east-1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment