ctx is a powerful CLI tool designed for DevOps professionals, simplifying the management of multiple cloud environments and infrastructures. With easy switching across AWS profiles, Kubernetes clusters, VPN connections, and SSH tunnels, ctx enhances productivity and reduces the complexity of context management, all with just a single command.
ctx is a powerful command-line interface (CLI) tool designed to streamline operations across multiple cloud environments and infrastructure platforms. This tool simplifies the management of various resources by allowing users to switch between AWS profiles, Kubernetes clusters, VPN connections, and SSH tunnels effortlessly, all with a single command.
To initiate and manage contexts, the following commands can be utilized:
$ 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] $
To set up a new context configuration:
# 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 status
ctx # Show current context status
aws sts get-caller-identity # Use your AWS profile
kubectl get pods # Connected to your cluster
Comprehensive documentation and resources for getting started, configuration, inheritance, and more are available at vlebo.github.io/ctx.
No comments yet.
Sign in to be the first to comment.