awsx
Stop running 3 commands every time you switch AWS environments.
awsx switches your AWS profile + kubectl context + region in one command. Zero config — it auto-discovers your existing setup.
)
Built for DevOps/SRE engineers managing multiple AWS accounts and EKS clusters.
Features
- 🔀 Unified switching — AWS profile + kubectl context + region in one command
- 🧠 Auto-discovery —
awsx initscans your AWS profiles and kubeconfig, matches them automatically - 💾 Saved contexts — define environment combos, switch instantly
- 🔍 Fuzzy picker — interactive selection powered by skim (Rust fzf)
- 🔐 Auto SSO login — detects expired sessions, triggers
aws sso login - 📸 Auto-detect — captures current AWS profile, region, and kubectl context on save
- 🐚 Shell integration — eval-based env export for zsh/bash/fish
- 🎨 Color-coded — environments tagged as PRD/STG/DEV with colors
- ⚡ Fast — native Rust binary, ~6ms startup
Install
One-liner (recommended)
|
This will:
- Detect your OS and architecture (macOS/Linux, x86_64/arm64)
- Download the latest release binary (or build from source if no release available)
- Auto-add shell hook to your
.zshrc,.bashrc, orconfig.fish - Run
awsx initto auto-discover your environments
After install, reload your shell:
From source
Quick Start
Option 1: Auto-discover (recommended)
Scans your existing AWS profiles and kubectl contexts, then intelligently matches them:
Scanning AWS profiles and kubectl contexts...
5 AWS profiles found:
default, my-app-dev, my-app-stg, my-app-prd, data-platform
3 kubectl contexts found:
app-dev, app-stg, app-prd
✓ default → aws=default | region=us-east-1
✓ my-app-dev → aws=my-app-dev | k8s=app-dev
✓ my-app-stg → aws=my-app-stg | k8s=app-stg
✓ my-app-prd → aws=my-app-prd | k8s=app-prd
✓ data-platform → aws=data-platform
✓ 5 contexts saved.
How matching works:
- Account ID matching — reads
sso_account_idorrole_arnfrom your AWS config, matches to EKS cluster ARNs in kubeconfig - Token-based name scoring — tokenizes names (splits by
-,_,.), scores by overlap percentage - Unmatched entries — AWS-only profiles and kubectl-only contexts are saved as standalone entries
Works with any setup: AWS SSO, IAM assume-role, IAM access keys, EKS, GKE, self-hosted clusters, or kubectl-only environments.
Option 2: Save from current state
Switch to your environment manually once, then let awsx capture it:
# Save — auto-detects current profile, region, and kubectl context
Option 3: Save with explicit flags
Switch
Commands
| Command | Description |
|---|---|
awsx init |
Auto-discover AWS profiles and kubectl contexts |
awsx use [name] |
Switch to saved context (interactive if no name) |
awsx profile [name] |
Switch AWS profile only |
awsx kube [name] |
Switch kubectl context only |
awsx save <name> |
Save a context (auto-detects current state, or use flags) |
awsx delete <name> |
Delete a saved context |
awsx list |
List all saved contexts |
awsx current |
Show current active context |
awsx shell-hook <shell> |
Output shell hook (zsh/bash/fish) |
awsx clear |
Unset all AWS environment variables |
Config
Contexts are stored per engineer in ~/.config/awsx/config.toml:
[]
= "my-prd-profile"
= "ap-southeast-1"
= "my-prd-cluster"
= "default"
= "production"
This file is local — context names and mappings can differ between machines. Run awsx init on each machine to auto-generate.
Uninstall
|
Requirements
- AWS CLI v2
- kubectl (optional, for Kubernetes context switching)
Why awsx?
| Tool | AWS profile | kubectl context | Region | Auto-discover | One binary |
|---|---|---|---|---|---|
| awsx | ✅ | ✅ | ✅ | ✅ | ✅ |
| awsp | ✅ | ❌ | ❌ | ❌ | ❌ (shell) |
| aws-vault | ✅ | ❌ | ❌ | ❌ | ✅ |
| kubectx | ❌ | ✅ | ❌ | ❌ | ✅ |
| awsume | ✅ | ❌ | ✅ | ❌ | ❌ (python) |
License
MIT