Switch between AWS profiles interactively using fzf, or set one directly by name. Automatically triggers aws sso login if credentials are expired.
Clone the repo and add a source line to ~/.zshrc:
git clone https://github.com/chris-code-lab/awsp ~/.awsp
echo 'source ~/.awsp/awsp.plugin.zsh' >> ~/.zshrc && source ~/.zshrcTo update later: git -C ~/.awsp pull
Oh My Zsh has its own plugin loader — clone directly into the custom plugins directory and it will find the plugin automatically:
git clone https://github.com/chris-code-lab/awsp ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/awspThen add awsp to the plugins array in ~/.zshrc and reload your shell:
plugins=(... awsp)source ~/.zshrcPlain zsh vs Oh My Zsh: with plain zsh you source the file yourself; with Oh My Zsh the framework handles loading — you just register the plugin name.
To update later: git -C ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/awsp pull
zinit can install directly from GitHub — add this to ~/.zshrc:
zinit light chris-code-lab/awspClone the repo and add a source line to ~/.bashrc:
git clone https://github.com/chris-code-lab/awsp ~/.awsp
echo 'source ~/.awsp/awsp.sh' >> ~/.bashrc && source ~/.bashrcTo update later: git -C ~/.awsp pull
awsp # open fzf picker to select a profile
awsp my-profile # set AWS_PROFILE directly
awsp none # unset AWS_PROFILEawsp switches between profiles defined in ~/.aws/config. You need at least one profile configured before using it.
To add an SSO profile:
aws configure sso --profile my-profileThis will generate entries in ~/.aws/config similar to:
[sso-session my-org]
sso_start_url = https://my-org.awsapps.com/start
sso_region = eu-west-1
sso_registration_scopes = sso:account:access
[profile dev]
sso_session = my-org
sso_account_id = 123456789012
sso_role_name = MyRole
region = eu-west-1
[profile prod]
sso_session = my-org
sso_account_id = 210987654321
sso_role_name = MyRole
region = eu-west-1For non-SSO profiles, use aws configure --profile my-profile. See the AWS CLI configuration docs for the full reference.
If you find this useful, give it a ⭐
