CLI Reference
Complete reference for the CloudNexus command-line interface. Manage infrastructure, deploy applications, and monitor services directly from your terminal.
The CLI requires v3.0+ of the CloudNexus SDK. Ensure your shell supports POSIX-compliant paths and bash/zsh/fish environments.
Overview
The cnx command provides a unified interface to interact with the CloudNexus control plane. It supports interactive and non-interactive modes, JSON output formatting, and seamless integration with CI/CD pipelines.
cnx # Display help & available commands
cnx --version
cnx --help command
Installation
Install the CLI via our official install script or package managers. Automatic checksum verification and binary signing are enforced.
Quick Install (macOS/Linux)
curl -sSL https://cli.cloudnexus.dev/install.sh | bash
Package Managers
brew tap cloudnexus/tap
brew install cnx-cli
npm install -g @cloudnexus/cli
# or
yarn global add @cloudnexus/cli
Authentication
Authenticate using API keys or SSO. Credentials are stored securely in ~/.cloudnexus/credentials.
cnx auth login
# Interactive browser flow or token paste
cnx auth login --token YOUR_API_KEY
# CI/CD non-interactive mode
Configuration
Manage project profiles, defaults, and environment overrides via ~/.cloudnexus/config.yaml.
| Field | Type | Description |
|---|---|---|
profile |
string | Active credential profile |
region |
string | Default deployment region (e.g., us-east-1) |
format |
string | Output format: human, json, yaml |
auto_update |
boolean | Enable CLI auto-updates on launch |
cnx deploy
Build, containerize, and push application artifacts to CloudNexus edge networks. Supports Docker, Knative, and raw container images.
cnx deploy [FLAGS] [DIRECTORY]
| Flag | Type | Required | Description |
|---|---|---|---|
--name |
string | Required | Service name identifier |
--region |
string | Optional | Target deployment region |
--env |
file | Optional | Path to .env file |
--wait |
boolean | Optional | Block until healthy |
Example
cnx deploy --name api-prod --region eu-west --wait
â ´ Packaging artifacts...
â Build complete (14s)
â Pushed to registry: cnx.eu-west/api-prod:v2.1.0
â Deployed to 3 regions
â Healthy: https://api-prod.cloudnexus.dev
cnx scale
Adjust replica counts or configure auto-scaling policies for running services.
cnx scale [FLAGS]
# Manual scaling
cnx scale api-prod --replicas 6
# Enable auto-scaling
cnx scale api-prod --min 2 --max 20 --metric cpu:75%
cnx logs
Stream structured application and infrastructure logs in real-time. Supports filtering by region, replica, and log level.
cnx logs api-prod --follow --level warn
# Ctrl+C to stop streaming
cnx dns
Manage DNS records, CNAMEs, and TLS certificates for custom domains.
cnx dns create api.example.com --target api-prod --ssl auto
cnx secrets
Inject and rotate encrypted environment variables securely across deployments.
| Command | Description |
|---|---|
cnx secrets set | Store a new secret |
cnx secrets list | View all secret names (values masked) |
cnx secrets rotate | Zero-downtime secret rotation |
cnx secrets delete | Remove a secret from all running replicas |
Global Flags
Available on all cnx commands.
| Flag | Type | Description |
|---|---|---|
--verbose / -v |
boolean | Enable debug logging |
--json |
boolean | Force JSON output for scripting |
--profile |
string | Override active credential profile |
--no-color |
boolean | Disable terminal coloring |
--timeout |
duration | Command execution timeout (default: 120s) |
Exit Codes
| Code | Meaning |
|---|---|
0 | Success |
1 | Generic error / CLI crash |
4 | Authentication failed |
8 | Validation error (invalid flags/config) |
13 | Rate limit exceeded |
24 | Operation timeout |
Environment Variables
Override CLI behavior programmatically.
| Variable | Description |
|---|---|
CNX_TOKEN | API authentication token |
CNX_REGION | Default target region |
CNX_OUTPUT | Force output format (json|yaml|human) |
CNX_DEBUG | Enable verbose logging (set to 1 or true) |
Run cnx help <command> for inline documentation, or visit our Developer Community for advanced use cases and troubleshooting.