Context switcher for DevOps
ctx is a CLI tool that simplifies working across multiple cloud environments, projects, and infrastructure platforms. Switch between AWS profiles, Kubernetes clusters, VPN connections, and SSH tunnels with a single command.
$ ctx list
NAME ENVIRONMENT CLOUD ORCHESTRATION
acme-dev development aws kubernetes
acme-staging staging aws kubernetes
acme-prod production aws kubernetes
$ ctx use acme-prod
✓ AWS profile: acme-prod (us-east-1)
✓ Kubernetes: prod-cluster/default
✓ VPN connected: wireguard (wg0)
✓ Tunnels: postgres, redis
[ctx: acme-prod] $
| Category | Features |
|---|---|
| Cloud Providers | AWS, GCP, Azure profile switching with auto-login support |
| Orchestration | Kubernetes, Nomad, Consul context management |
| Networking | SSH tunnels with auto-reconnect, per-tunnel management |
| VPN | OpenVPN, WireGuard, Tailscale, custom commands |
| Secrets | Bitwarden, 1Password, Vault, AWS Secrets Manager, AWS SSM, GCP Secret Manager |
| Identity | Per-context Git user configuration |
| Registries | Docker and NPM registry configuration |
| Browser | Chrome/Firefox profile per context for SSO workflows |
| Shell | Per-shell contexts, colored prompts, environment isolation |
| Inheritance | Base/abstract contexts with multi-level inheritance |
curl -fsSL https://github.com/vlebo/ctx/releases/latest/download/install.sh | shAdd to your ~/.zshrc or ~/.bashrc:
eval "$(ctx shell-hook zsh)" # for Zsh
eval "$(ctx shell-hook bash)" # for Bash# Initialize ctx
ctx init
# Create a context file at ~/.config/ctx/contexts/myproject-dev.yaml
cat > ~/.config/ctx/contexts/myproject-dev.yaml << 'EOF'
name: myproject-dev
description: "MyProject Development Environment"
environment: development
aws:
profile: myproject-dev
region: us-west-2
kubernetes:
context: arn:aws:eks:us-west-2:123456789:cluster/dev
namespace: default
EOF
# Switch to the context
ctx use myproject-dev
# Verify
ctx # Show current context status
aws sts get-caller-identity # Using your AWS profile
kubectl get pods # Connected to your clusterFull documentation is available at vlebo.github.io/ctx
- Getting Started - Installation and first context
- Configuration Overview - Complete configuration reference
- Context Inheritance - Avoid repeating configuration
- CLI Reference - All available commands
- AWS Setup - SSO, aws-vault, Secrets Manager
- Secrets Management - Bitwarden, 1Password, Vault, and more
- VPN - OpenVPN, WireGuard, Tailscale
- SSH Tunnels - Auto-connect tunnels
- Tips & Best Practices - Production safety, credential isolation
| Platform | Status |
|---|---|
| Linux | Full support |
| macOS | Full support |
| Windows | WSL required |
We welcome contributions! See CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.