Skip to content

Instantly share code, notes, and snippets.

@tyrelsouza
Last active May 6, 2025 19:48
Show Gist options
  • Save tyrelsouza/4b259a7d7759a50a9a4ec84eda84973a to your computer and use it in GitHub Desktop.
Save tyrelsouza/4b259a7d7759a50a9a4ec84eda84973a to your computer and use it in GitHub Desktop.
FZF Select AWS Profile

Instructions

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.

Requirements

  • 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment