Skip to content

Instantly share code, notes, and snippets.

@enriched
Created January 19, 2022 21:51
Show Gist options
  • Save enriched/cf71e0e0057d34ab9ecf52c39a6c0f95 to your computer and use it in GitHub Desktop.
Save enriched/cf71e0e0057d34ab9ecf52c39a6c0f95 to your computer and use it in GitHub Desktop.
AWS SSO Login with profile selection
#!/usr/bin/env bash
set -eo pipefail
PATTERN=${1}
SELECTED_PROFILE=$(cat ~/.aws/config | awk '/\[.+\]/{ gsub(/(\[profile[ ]+|\])/, ""); print }' \
| fzf-tmux --height 30% --reverse -1 -0 --header 'Select AWS profile' --query "$PATTERN")
aws sso login --profile "$SELECTED_PROFILE"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment