PitchHut logo
Seamlessly switch between cloud environments and infrastructure.
Pitch

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.

Description

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.

Key Features

  • Cloud Providers: Effortlessly switch between AWS, GCP, and Azure profiles, including support for auto-login.
  • Orchestration Management: Handle Kubernetes, Nomad, and Consul contexts with ease.
  • Networking Solutions: Manage SSH tunnels with features such as auto-reconnect and per-tunnel customization.
  • VPN Integration: Seamlessly connect using OpenVPN, WireGuard, Tailscale, and the ability to add custom commands.
  • Secrets Management: Interface with Bitwarden, 1Password, Vault, AWS Secrets Manager, AWS SSM, and GCP Secret Manager for secure handling of secrets.
  • User Identity Handling: Configure a per-context Git user for enhanced security and ease of use.
  • Registry Management: Easily configure Docker and NPM registries within contexts.
  • Browser Profiles: Set up specific Chrome or Firefox profiles for single sign-on (SSO) workflows per context.
  • Shell Customization: Create per-shell contexts with colored prompts for an organized environment.
  • Context Inheritance: Use base and abstract contexts to minimize configuration duplication across environments.

Usage Example

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] $

Quick Start Guide

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

Documentation

Comprehensive documentation and resources for getting started, configuration, inheritance, and more are available at vlebo.github.io/ctx.

0 comments

No comments yet.

Sign in to be the first to comment.