Last active
February 28, 2024 02:04
-
-
Save wfairclough/df8229ea0da2a46a7b7f1e424e2f2d56 to your computer and use it in GitHub Desktop.
AWS cli SSO quick select shell script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Quick search and select the AWS profile to use for SSO login | |
AWS_PROFILE=$(cat ~/.aws/config | rg 'profile' | awk '{print $2}' | sed 's/]//g' | sort | fzf) | |
if [ -z "$AWS_PROFILE" ]; then | |
echo "No profile selected" | |
exit 1 | |
fi | |
export AWS_PROFILE | |
aws sso login | |
echo "You are now logged in to AWS with the $AWS_PROFILE profile" | |
echo "" | |
echo "export AWS_PROFILE=\"$AWS_PROFILE\"" | |
echo "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment