tfaws - AWS Profile Manager
February 25, 2026 ยท View on GitHub
A Zsh plugin for Oh My Zsh that simplifies switching between AWS profiles
Features
- ๐ Switch between AWS profiles with automatic SSO authentication
- ๐ฏ Interactive profile selection with fzf support
Installation
Oh My Zsh Custom Plugin
-
Clone this repository into your Oh My Zsh custom plugins directory:
git clone https://github.com/jmischler72/tfaws.git $ZSH_CUSTOM/plugins/tfaws -
Add
awsandtfawsto your plugins list in~/.zshrc:plugins=(... aws tfaws) -
Reload your shell:
source ~/.zshrc
Usage
Commands
tfaws [COMMAND] [PROFILE]
Available Commands
| Command | Description |
|---|---|
<profile> | Switch to the specified AWS profile, if <profile> empty it clears profile |
ls, list | List and interactively select an AWS profile |
sh, show | Show current AWS profile and Terraform path |
Examples
# Switch to 'dev' profile
tfaws dev
# Interactive profile selection (uses fzf if available)
tfaws list
# Show current profile and path
tfaws show
Requirements
- Zsh shell
- Oh My Zsh
- AWS CLI v2 with configured profiles
fzf(optional, for enhanced interactive selection)
Dependencies
The plugin assumes you have AWS profiles configured and uses:
aws sts get-caller-identity- to check authentication statusaws sso login- for SSO authenticationaws_profiles- to list available profiles (assumed to be available)
How It Works
Profile Switching: When you switch profiles, the plugin:
- Uses
asp(change_context) to set the AWS profile - Extracts the SSO session name from
~/.aws/config - Runs
aws sso loginto ensure authentication
Troubleshooting
Common Issues
- Profile not found: Ensure your AWS profile exists in
~/.aws/config - Authentication failed: The plugin will automatically run
aws sso loginwhen needed
Debug Information
Use tfaws show to see current configuration:
tfaws show
# Output:
# Current AWS Profile: dev
# Current Terraform Path: /home/user/terraform/dev
License
This project is licensed under the terms specified in the LICENSE file.