CLI v3.0 is currently in alpha. Commands and flags may change before the stable release.
Authentication
Before using any commands that interact with Nscale resources, authenticate with:
This opens a browser window to complete authentication. On success, your credentials are stored locally.
To log out:
Global Flags
These flags are available on every command:
| Flag | Description |
|---|
--ci | Indicates the CLI is running in a CI environment (also set via CI env var) |
--context string | Specify the context to use |
-u, --user string | Specify the user credentials to use (default: "default") |
-h, --help | Show help for any command |
Environment Variables
| Variable | Description |
|---|
CI | Override the --ci flag |
NSCALE_SERVICE_TOKEN | Service token for authorization — bypasses stored credentials, useful for CI/CD |
Contexts
Contexts let you switch between different organizations and user configurations without re-specifying flags on every command.
# Create or update a context
nscale contexts set --name my-context --org <org-id>
# Switch to a context
nscale contexts use my-context
# List all contexts
nscale contexts list
Most list and get commands support a --json flag for machine-readable output:
nscale instances list --org <org-id> --json
create and update commands accept input from a JSON file (--file) or standard input (--stdin):
nscale instances create --file instance.json
cat instance.json | nscale instances create --stdin
Use --dry-run to preview the request payload without making any changes:
nscale instances create --file instance.json --dry-run
Interactive Mode
When running outside of a CI environment, the CLI falls back to interactive prompts for any missing parameters. This means you can run commands without flags and be guided through the required inputs step by step.
For example, list commands will present an organization picker if --org is not provided:
create commands will prompt for each required field when no --file or --stdin input is given:
To suppress interactive prompts (e.g. in scripts), pass --ci or set the CI environment variable.
Shell Completion
Bash
# Load completions for current session
source <(nscale completion bash)
# To load completions for every new session, execute once:
# Linux:
sudo nscale completion bash > /etc/bash_completion.d/nscale
# macOS:
# First, ensure bash-completion is installed
# brew install bash-completion
nscale completion bash > $(brew --prefix)/etc/bash_completion.d/nscale
# Then add to ~/.bash_profile:
# [[ -r "$(brew --prefix)/etc/profile.d/bash_completion.sh" ]] && . "$(brew --prefix)/etc/profile.d/bash_completion.sh"
Zsh
# Load completions for current session
source <(nscale completion zsh)
# To load completions for every session, execute once:
# First, check your fpath directories to find the right location:
echo $fpath
# Then, create a directory for completions if it doesn't exist:
mkdir -p ~/.zsh/completions
nscale completion zsh > ~/.zsh/completions/_nscale
# If shell completion is not already enabled in your environment,
# you will need to enable it. You can execute the following once:
echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
# You will need to source your ~/.zshrc or start a new shell for this setup to take effect.
source ~/.zshrc
Fish
# Load completions for current session
nscale completion fish | source
# To load completions for every session, execute once:
mkdir -p ~/.config/fish/completions
nscale completion fish > ~/.config/fish/completions/nscale.fish
PowerShell
# Load completions for current session
nscale completion powershell | Out-String | Invoke-Expression
# To load completions for every new session, run:
nscale completion powershell > nscale.ps1
# and source this file from your PowerShell profile.
Available Commands
| Command | Description |
|---|
contexts | Manage CLI contexts |
filestorage | Manage file storage resources |
flavors | List available compute flavors |
groups | Manage groups |
images | Manage compute images |
instances | Manage compute instances |
login | Authenticate with Nscale |
logout | Log out of the Nscale CLI |
networks | Manage VPC networks |
organizations | List organizations |
projects | Manage projects |
regions | List available regions |
securitygroups | Manage security groups |
serviceaccounts | Manage service accounts |
version | Display the CLI version |