cloudnx CLI

Cobra-based CLI for the CloudNx platform. Reads ~/.cloudnx/credentials (TOML, profile-keyed), exchanges access keys for a 15-min JWT once per invocation, and ships every operation the dashboard supports.

Install

git clone https://github.com/vomayank/cloudnx-platform
cd cloudnx-platform/cli
go build -o cloudnx .
sudo install -m 0755 cloudnx /usr/local/bin/

cloudnx --version
# cloudnx version 0.1.0

First-time setup

cloudnx configure
# CloudNx endpoint [https://cloudnx.in]:
# Access key ID:    AKIACLOUDNX0123456789
# Secret key:       ********
# Default output [table | json]: table

cloudnx whoami
# Account: 100000003 (Acme Inc.)
# Identity: developer (IAM user)

Global flags

FlagEnv varDefault
--profileCLOUDNX_PROFILEdefault
--outputtable (also: json)
--helpworks on every subcommand

Commands

Identity

cloudnx whoami
cloudnx configure
cloudnx iam user ls
cloudnx iam user create developer \
  --display-name "Backend Developer" \
  --console-password 'ChangeMe9$'
cloudnx iam user set-password developer "NewPass99!"   # "" to disable console
cloudnx iam user rm developer

Access keys + policies + groups

cloudnx iam key create developer       # secret shown ONCE
cloudnx iam key ls developer
cloudnx iam key rm developer <key_id>

cloudnx iam policy ls
cloudnx iam policy attach developer <policy-id>
cloudnx iam policy detach developer <policy-id>

cloudnx iam group create devs "Developer team"
cloudnx iam group add-user devs developer
cloudnx iam group remove-user devs developer
cloudnx iam group rm devs

Compute

cloudnx instance ls
cloudnx instance show <id>
cloudnx instance create \
  --name web-01 \
  --image ubuntu-22.04 \
  --plan small \
  --ssh-key my-laptop
cloudnx instance start  <id>
cloudnx instance stop   <id>
cloudnx instance reboot <id>
cloudnx instance rm     <id>

Storage

cloudnx bucket ls
cloudnx bucket create my-bucket
cloudnx bucket rm my-bucket

cloudnx s3 ls s3://my-bucket
cloudnx s3 cp ./local.tgz s3://my-bucket/backups/local.tgz
cloudnx s3 cp s3://my-bucket/report.pdf ./report.pdf
cloudnx s3 rm s3://my-bucket/old-file.txt

Billing

cloudnx billing show
# METRIC                  | VALUE
# Wallet balance          | ₹1,234.56
# Month-to-date spend     | ₹312.40
# Daily run rate          | ₹52.10
# Projected month-end     | ₹1,820.00
# Runway at current rate  | 23.7 days

Recipes

Provision and SSH

ID=$(cloudnx instance create --name api-01 --image ubuntu-22.04 --plan small --ssh-key my-laptop --output json | jq -r '.id')
HOST=$(cloudnx instance show $ID --output json | jq -r '.public_hostname')
PORT=$(cloudnx instance show $ID --output json | jq -r '.ssh_port')
ssh -p $PORT root@$HOST

CI cost guardrail

projected=$(cloudnx billing show --output json | jq '.projected_month_paise')
limit_paise=$((50000 * 100))   # ₹50,000 budget
if [ "$projected" -gt "$limit_paise" ]; then
  echo "Projected spend exceeds budget — failing build" >&2
  exit 1
fi

Authentication internals

The CLI uses AWS SigV4-compatible signing — the secret never leaves your laptop, only an HMAC of the canonical request travels over the wire.

  1. First call in a process: signed POST /auth/iam/exchange-credentials returns a 15-minute access token.
  2. Token cached in-process; subsequent calls reuse it until <60s remain.
  3. On expiry, the next call transparently re-exchanges.

Troubleshooting

SymptomProbable cause
unauthorized on first callBad access key or secret in ~/.cloudnx/credentials.
403 only the account owner can manage IAMYou’re calling iam … from an IAM user; that’s root-only.
403 console login is not enabledThe user has no password_hash — set one first.
region must be "in-mum"SigV4 region mismatch; CLI expects this region.
request timestamp outside acceptable skewLocal clock off by ≥ 5 min; sync time.

Set CLOUDNX_DEBUG=1 to print the underlying HTTP exchange (headers + body) when filing a bug at github.com/vomayank/cloudnx-platform/issues.

For language-specific SDKs (in progress), see SDKs.