Resources·Tutorials

Automate your VPS workflow with the RareCloud CLI

Install the rarecloud CLI, authenticate with an API token, and script common operations: create servers, back up before a deploy, open a console, check your balance. Replaces the dashboard for repetitive work.

By RareCloud Team · 8 min read · 20 May 2026 · Updated 9 Oct 2026

If you're managing more than a handful of services, the dashboard stops being the right tool. You want to script things: back up before a deploy, spin up a throwaway server for a load test and tear it down an hour later. That's what the CLI is for.

This tutorial walks through install, auth, and the commands you'll actually run day to day.

Install

The CLI is a single Go binary: no runtime, no dependencies.

One-line install on Linux or macOS:

curl -fsSL https://raw.githubusercontent.com/RareCloudio/rarecloud-cli/main/install.sh | sh

Or with Homebrew (macOS or Linux):

brew install rarecloudio/tap/rarecloud

Or grab a standalone build for your platform, macOS (.tar.gz), Linux (.deb, .rpm, .tar.gz) or Windows (.zip), from the GitHub releases page, put it on your $PATH, and make it executable:

# Pick the asset matching your OS + architecture from the releases page, then:
chmod +x rarecloud
sudo mv rarecloud /usr/local/bin/

On Windows, download the .zip, extract rarecloud.exe, and drop it in a folder on your PATH. Once installed, rarecloud upgrade self-updates the binary in place.

Confirm it works:

$ rarecloud --version
rarecloud version 0.4.0

Authenticate

Create an API token in the console at Account, then API tokens, then New token. Scope it to what the script needs: services:read for listing and monitoring, plus services:write if you'll be creating or destroying resources (scopes match exactly, so :write does not include :read), and billing:read for the balance. Tokens are shown once; copy it immediately.

Then:

$ rarecloud auth login
Paste your API token (or pipe it in): rc_pat_...
Logged in as you@example.com. Token saved to /home/you/.config/rarecloud/config.toml.

The CLI stores the token in config.toml in your user config folder (~/.config/rarecloud/ on Linux, ~/Library/Application Support/rarecloud/ on macOS). The pasted token is shown on screen, so run it where nobody is looking over your shoulder. For CI, skip rarecloud auth login and export RARECLOUD_TOKEN directly.

The commands you'll actually use

Listing your resources

$ rarecloud server list
ID         KIND           NAME        IPV4            POWER    SPECS             REGION
40213      legacy_vps     api-prod-1  203.0.113.12    running  4vCPU/8GB/100GB   frankfurt-de
40388      legacy_vps     worker-2    203.0.113.41    running  2vCPU/4GB/50GB    the-hague-nl
3e0d7d73…  cloud_compute  web-01      203.0.113.77    running  2vCPU/8GB/100GB   bucharest-ro

Classic VPS have numeric ids; cloud VMs have UUIDs, which the table shortens. Add --output json | jq for the full ids and machine-readable output, and you have a one-liner for any monitoring dashboard. In JSON mode the list holds every service on the account (hosting and proxies too), so filter on kind.

Back up before a deploy

The classic pattern: back up your prod VPS, deploy the new code, restore if something blows up. These backup commands work on classic VPS; for cloud VMs, take a snapshot in the console.

$ rarecloud server backup create 40213
✔ Backup creation queued for 40213

Confirm it landed:

$ rarecloud server backup list 40213
ID              CREATED               STATUS
bkp_01H8EC...   2026-05-20T14:02:11Z  available

Now ship your deploy. If it breaks, restore that backup from the server's management panel in the console to roll back to the pre-deploy state.

Spin up a throwaway server

For a load test, a CI runner, or trying a new tool, use a cloud VM: it is billed by the hour, so you pay only for the hours it exists. --plan takes a plan SKU; list the sizes with rarecloud catalog plans <product-sku> (cloud VMs use plans like s-1vcpu-2gb or g-2vcpu-8gb in --region bucharest-ro):

# --ssh-key takes a registered key id (see `rarecloud ssh-key list`),
# not a file path. Register your key once with `rarecloud ssh-key add`.
$ rarecloud server create \
    --plan s-1vcpu-2gb \
    --region bucharest-ro \
    --image ubuntu-24.04 \
    --ssh-key <key-id> \
    --tag loadtest \
    --name loadtest-$(date +%s)
✔ Server provisioned: 9b2f4c1e-...
  IPv4: 203.0.113.99

In a script, run rarecloud server check with the same flags first. It asks the API whether the order would be accepted (balance, unpaid invoices) without creating anything, and exits 0 when it would be, 2 when it would be refused, so the script can stop and print the reason. If the connection drops while server create waits for its answer, the CLI retries with the same idempotency key and the API creates the server only once; if it still fails, the error prints the key to pass with --idempotency-key on a retry.

Use it, then:

$ rarecloud server destroy 9b2f4c1e-... --yes
✔ Server 9b2f4c1e-... destroyed.

Get an out-of-band console when SSH is down

$ rarecloud server console 40213

This returns a web console (noVNC) URL for the server. Handy when SSH is locked out (firewall misconfig, network-rule mistake) and you need browser-based console access to fix it.

Check your credit balance from a script

$ rarecloud credit balance --output json | jq -r '.available.amount'
127.45

Use in a CI hook to warn when you're running low.

Scripting patterns

A short bash snippet that backs up all your classic VPS nightly:

#!/usr/bin/env bash
set -euo pipefail

rarecloud server list --output json | \
  jq -r '.[] | select(.kind == "legacy_vps") | .id' | \
  while read -r SRV; do
    rarecloud server backup create "$SRV"
  done

Throw it in a cron, point a Healthchecks.io URL at it for monitoring, done.

Where to go next

Frequently Asked Questions

Does the CLI work on Windows?
Yes. We publish standalone builds for macOS, Linux, and Windows on the GitHub releases page. On Windows, download the .zip, extract rarecloud.exe and drop it into a folder on your PATH.
Where are credentials stored?
In config.toml inside your user config folder: ~/.config/rarecloud/ on Linux (or $XDG_CONFIG_HOME/rarecloud/), ~/Library/Application Support/rarecloud/ on macOS, %AppData%\rarecloud\ on Windows. The CLI writes the file readable only by you (mode 0600). Tokens never touch shell history because you paste them at a prompt (or pipe them in).
Can I run the CLI from CI?
Yes. Set RARECLOUD_TOKEN as an environment variable in your CI secrets store and skip the rarecloud auth login step. Every command honors --output json for machine parsing.

Related