Skip to content

Instantly share code, notes, and snippets.

View Aur0nd's full-sized avatar

George Z Aur0nd

  • London
View GitHub Profile
@lukeplausin
lukeplausin / auto_configure_aws_cli_sso_roles.sh
Last active April 9, 2024 11:50
Automatically configure AWS SSO configuration file for all available accounts and roles
#!/bin/bash -e
# How to use this script:
# 1. Follow these instructions to configure a single AWS account to do initial login with SSO
# https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sso.html
# 2. Export AWS_PROFILE=... and then run "aws sso login" to get an SSO token
# 3. Once signed in with AWS SSO, run this script to automatically list out all the other accounts and roles and add them to your config file
# If you want to filter roles / accounts in the process, or validate config before committing it, you can customise the script to do this.