source awsp
Make sure you source this, as if you just run it, it will be in a subshell and your exports won't matter after.
- AWS CLI
- FZF
#!/usr/bin/env bash | |
# Check if fzf | |
if ! command -v fzf &> /dev/null; then | |
echo "Error: fzf is not installed. Please install fzf to use this script." | |
exit 1 | |
fi | |
profiles=$(aws configure list-profiles) | |
selected_profile=$(echo "$profiles" | fzf --prompt="Select AWS profile: ") | |
if [ -n "$selected_profile" ]; then | |
export AWS_PROFILE="$selected_profile" | |
echo "AWS_PROFILE set to: $AWS_PROFILE" | |
else | |
echo "No profile selected." | |
exit 1 | |
fi | |
# Optionally, uncomment this if you need to. | |
# eval $(aws configure export-credentials --format=env) |