CLI Reference

Complete reference for the CloudNexus command-line interface. Manage infrastructure, deploy applications, and monitor services directly from your terminal.

â„šī¸ Note

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.

Terminal
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)

Terminal
curl -sSL https://cli.cloudnexus.dev/install.sh | bash

Package Managers

Homebrew
brew tap cloudnexus/tap
brew install cnx-cli
npm / yarn
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.

Terminal
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.

Syntax
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

Terminal
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.

Syntax
cnx scale  [FLAGS]
Terminal
# 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.

Terminal
cnx logs api-prod --follow --level warn
# Ctrl+C to stop streaming

cnx dns

Manage DNS records, CNAMEs, and TLS certificates for custom domains.

Terminal
cnx dns create api.example.com --target api-prod --ssl auto

cnx secrets

Inject and rotate encrypted environment variables securely across deployments.

CommandDescription
cnx secrets setStore a new secret
cnx secrets listView all secret names (values masked)
cnx secrets rotateZero-downtime secret rotation
cnx secrets deleteRemove 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

CodeMeaning
0Success
1Generic error / CLI crash
4Authentication failed
8Validation error (invalid flags/config)
13Rate limit exceeded
24Operation timeout

Environment Variables

Override CLI behavior programmatically.

VariableDescription
CNX_TOKENAPI authentication token
CNX_REGIONDefault target region
CNX_OUTPUTForce output format (json|yaml|human)
CNX_DEBUGEnable verbose logging (set to 1 or true)
📖 Need more help?

Run cnx help <command> for inline documentation, or visit our Developer Community for advanced use cases and troubleshooting.