Fast AWS profile and region switcher, inspired by kubectx.
- Switch AWS profiles and regions with a single command
- Works immediately — no shell wrapper required
- Modifies
[default]in~/.aws/configand~/.aws/credentials(original backed up) - Interactive selection with fzf (if installed)
- Switch back to previous profile/region with
- - Tab completions for bash, zsh, and fish (optional)
- Current profile/region highlighted in listing
brew install yetmike/tap/awsctxThe easiest way to install without homebrew is via the installation script:
curl -sL https://raw.githubusercontent.com/yetmike/awsctx/main/install.sh | bash# Using go install
go install github.com/yetmike/awsctx/cmd/awsctx@latest
# Or manual build
git clone https://github.com/yetmike/awsctx
cd awsctx
sudo make installawsctx # show current profile and region
# Profile switching
awsctx profile # list profiles (interactive fzf if available)
awsctx p dev # switch to "dev" profile
awsctx p -c # show current profile
awsctx p - # switch to previous profile
awsctx p default # restore original default profile
# Region switching
awsctx region # list regions (interactive fzf if available)
awsctx r us-east-1 # switch to us-east-1
awsctx r -c # show current region
awsctx r - # switch to previous regionp is short for profile, r is short for region.
When you switch to a profile (e.g., awsctx p dev):
- The original
[default]section is backed up (in both config and credentials files) to[_awsctx_original_default]. - The target profile's settings are copied into
[default]. - AWS CLI reads
[default]automatically — no env vars needed.
Run awsctx p default to restore the original default profile from the backup.
No shell wrapper or source command needed. Just install the binary and use it.
For tab completion support, add the following to your shell configuration file (e.g., ~/.bashrc, ~/.zshrc, or ~/.config/fish/config.fish):
Bash/Zsh:
source /path/to/awsctx/shell/awsctx.shNote: If installed via Homebrew, completions are handled automatically (ensure your brew shell completion is set up).
