ctx_
Multi-environment context manager. Switch between cloud profiles, Kubernetes clusters, VPN connections, and SSH tunnels with a single command.
Go Linux / macOS / Windows MIT License
$ cat ~/.config/ctx/contexts/acme-prod.yaml
name: acme-prod
environment: production
aws:
profile: acme-prod
region: us-east-1
kubernetes:
context: prod-cluster
namespace: default
vpn:
type: wireguard
auto_connect: true
tunnels:
- name: postgres
remote_host: db.internal
$ 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
⚠️ Switching to PRODUCTION environment: acme-prod
Type 'yes' to confirm: yes
Tunnel postgres: localhost:5432 → db.internal:5432
VPN connected: wireguard
AWS profile: acme-prod (us-east-1)
Kubernetes: prod-cluster/default
Environment variables loaded
Context 'acme-prod' is now active.
[ctx: acme-prod] $
[ctx: acme-prod] $ kubectl get pods
NAME READY STATUS RESTARTS AGE
api-6bb4d8744b-qgs5g 1/1 Running 0 23d
worker-79697c98f4-69k99 2/2 Running 0 23d
frontend-6947fd5477-jsmns 1/1 Running 0 9d
[ctx: acme-prod] $ aws s3 ls
2025-08-21 19:54:09 acme-avatars
2025-03-07 17:23:14 acme-logos
2026-01-13 20:55:29 acme-assets-prod
2025-11-07 13:40:28 acme-terraform-state
[ctx: acme-prod] $
$ ctx --features
# Everything you need to manage multi-cloud, multi-cluster environments
[cloud] Cloud Profile Switching
Switch between AWS, GCP, and Azure profiles instantly. Automatic SSO/login, region configuration, and credential management per context. No more aws configure or manual profile juggling.
[k8s] Kubernetes & Nomad
Activate clusters with namespace automatically set. Works with EKS, GKE, AKS, and self-hosted clusters. Also supports HashiCorp Nomad for non-Kubernetes orchestration needs.
[ssh] SSH Tunnel Management
Define SSH tunnels per context and auto-connect on switch. Built-in health monitoring and automatic reconnection. Access databases, internal services, and jump hosts seamlessly.
[vpn] VPN Auto-Connect
Automatically connect to OpenVPN, WireGuard, or Tailscale when switching contexts. Each environment can have its own VPN configuration. Disconnect when switching away.
[secrets] Secrets Management
Fetch secrets from Bitwarden, 1Password, HashiCorp Vault, AWS Secrets Manager, AWS SSM, or GCP Secret Manager. Inject them as environment variables automatically on context switch.
[shell] Shell Isolation
Each terminal session maintains its own context. Work on production in one terminal, development in another. No conflicts, no accidents, no cross-contamination.
[browser] Browser Profiles
Open bookmarks in specific Chrome or Firefox profiles based on active context. Access AWS Console, Grafana, or other dashboards in the right browser profile automatically.
[env] Environment Variables
Load context-specific environment variables automatically. API keys, database URLs, feature flags - all managed per context and injected into your shell session.
$ ctx --platforms
# Supported cloud providers, orchestrators, and tools
Cloud Providers
AWS (SSO, IAM)
Google Cloud Platform
Microsoft Azure
Orchestration
Kubernetes (EKS, GKE, AKS)
HashiCorp Nomad
Custom kubeconfig
VPN
WireGuard
OpenVPN
Tailscale
Custom scripts
Secrets
Bitwarden & 1Password
HashiCorp Vault
AWS Secrets Manager & SSM
GCP Secret Manager
$ ctx --how-it-works
# Simple workflow, powerful results
1
Define your contexts
Create YAML files in ~/.config/ctx/contexts/ describing each environment. Include cloud profiles, clusters, tunnels, VPN settings, and environment variables.
2
Add shell hook
Add eval "$(ctx shell-hook zsh)" to your shell config. This enables session isolation and the [ctx: name] prompt indicator.
3
Switch with one command
Run ctx use <context> to activate everything: cloud credentials, cluster config, VPN connection, SSH tunnels, and environment variables.
4
Work safely
Production contexts require confirmation. Each terminal session is isolated. Your prompt shows the active context. No more accidental kubectl delete on the wrong cluster.
$ ctx --config-examples
# Example context configurations
~/.config/ctx/contexts/staging.yaml
name: staging
environment: staging

aws:
  profile: company-staging
  region: us-west-2
  sso: true

kubernetes:
  context: eks-staging
  namespace: app

tunnels:
  - name: redis
    local_port: 6379
    remote_host: redis.internal
    remote_port: 6379
~/.config/ctx/contexts/production.yaml
name: production
environment: production

aws:
  profile: company-prod
  region: us-east-1

kubernetes:
  context: eks-production
  namespace: default

vpn:
  type: wireguard
  config: /etc/wireguard/prod.conf
  auto_connect: true

vault:
  address: https://vault.company.com
  auth: oidc
$ ctx --install
# Get started in under a minute
# install via script
curl -fsSL https://github.com/vlebo/ctx/releases/latest/download/install.sh | sh
# or build from source
git clone https://github.com/vlebo/ctx.git cd ctx go build -o ctx ./cmd/ctx sudo mv ctx /usr/local/bin/
# add shell hook to ~/.zshrc or ~/.bashrc
eval "$(ctx shell-hook zsh)"
# initialize ctx
ctx init