HF Cloud
Docs / CLI (hfc)

CLI (hfc)

Manage HF Cloud servers from your terminal and from CI with the hfc command line tool.

hfc is the command line tool for HF Cloud. It talks to the same API as the console and Terraform.

The CLI is new and still growing. Run hfc --help (or hfc <command> --help) for the commands and flags of the version you have installed.

Install

Binaries for Linux, macOS and Windows (amd64 and arm64) are single static files. Until public releases are published, ask support for a build or build it from source (Go 1.24+):

make build && install -m 0755 hfc ~/.local/bin/hfc
hfc version
hfc completion bash > ~/.local/share/bash-completion/completions/hfc   # also zsh, fish, powershell

Sign in

Create an API token in the console (API → New token) and log in. The CLI asks for the token and remembers it for the following commands:

hfc auth login                         # asks for the token (hidden), checks it, saves it (mode 0600)
hfc auth status                        # who you are, token name and expiry (never the token)
hfc auth login --context staging --endpoint https://other.example/api/cloud/v1
hfc --context staging server list      # one command against another context

This portal's API endpoint is https://hfcloud.eu/api/cloud/v1. The token is stored in ~/.config/hfc/config.toml; hfc auth logout removes it locally (revoke a leaked token in the console).

Common commands

hfc server list --label env=prod       # servers with that label
hfc server create --name web-1 --image ubuntu-24.04 --size S --ssh-key laptop \
    --label env=prod --security-group web --user-data @cloud-init.yaml --wait
hfc server ssh web-1                   # SSH as the image's default user
hfc server update web-1 --size M --stop  # shuts down, resizes, starts again
hfc server snapshot create web-1 --label before-upgrade
hfc server reboot web-1 --wait
hfc server delete web-1                # type the name to confirm (or --yes in scripts)

hfc ssh-key add --name ci --file ~/.ssh/id_ed25519.pub --scope organization
hfc lb list
hfc firewall vpn device add edge --name laptop --qr   # WireGuard config, shown once
hfc ip reserve --location LJ02 && hfc ip assign 203.0.113.25 web-1
hfc webhook create --url https://example.com/hooks/hfcloud --event server.ready --event server.failed

Servers, load balancers, firewalls, keys, security groups and reserved IPs can be named by id or by exact name.

Output: tables by default, -o wide for more columns, -o json / -o yaml for the API data unchanged, -q for ids only. Progress goes to stderr, so stdout carries only data. Exit codes: 0 ok, 1 error, 2 wrong usage, 3 not found, 4 not logged in or not allowed.

hfc server list -o json | jq -r '.[] | select(.status == "ready") | "\(.name) \(.ipv4)"'

Use in CI

Do not run hfc auth login in a pipeline. Use a service token (it keeps working when people leave and has the member or viewer role), store it as a secret and pass it through the environment:

export HFCLOUD_TOKEN="$HFCLOUD_TOKEN_SECRET"   # HFCLOUD_ENDPOINT for another portal
hfc server list -o json
hfc server delete review-$PR --yes             # no prompt without a terminal: --yes is required

Restrict the token to your CI runners' addresses with an IP allow list where you can. See GitHub Actions for a complete workflow.