hetzner-fleet — provision bare metal and VPS directly into your mesh from Hetzner Cloud
Hetzner Cloud is a European VPS provider with a flat, pleasant API: one bearer token, no
IAM, no service accounts. This skill wires it in as a provisioning target so a single
deploy call spins up a server, attaches your SSH key, and registers it with your fleet.
Requires: an AitherOS deployment with its AitherComet mesh-deployment service and a
secrets vault holding the Hetzner API token.
Live-measured against the Hetzner API v1 on 2026-07-27. Every number below was read
from the API, not from marketing pages. Two findings worth knowing before you start:
- A fresh project has no SSH key, and that blocks everything. Creating a server with
no
ssh_keys makes Hetzner email you a root password instead — a credential you
did not choose and that never reaches your automation. Upload a key first. Verified:
the bootstrap uploaded one key, re-running reported Already existed: True and
created no duplicate, and the API then reported exactly 1 key.
- Capacity is genuinely constrained right now — Hetzner has a standing
"limited availability of cloud instances" advisory. Measured live availability by
datacenter:
nbg1-dc3 12 server types, hel1-dc2 12, ash-dc1 10, hil-dc1 10,
sin-dc1 12 — and fsn1-dc14: ZERO. A provision that fails for no capacity is
not your bug. Retry in another location.
Not verified here: nothing in this document claims a provisioning duration, because no
server was created while writing it. If you see a wall-clock figure quoted for
"time to running", it did not come from this skill.
How it's wired
AitherComet (the mesh deployment service) routes cloud provisioning through a provider-
dispatch layer. Hetzner and DigitalOcean sit alongside the GPU-rental providers in that
same layer. Three moving parts are needed:
- SSH public key in Hetzner account (prerequisite; you do this once)
- API token in vault (prerequisite; platform does this)
- REST call to POST /deploy (you do this to provision)
┌─────────────────────────────────────────┐
│ You: POST /deploy │
│ { │
│ "deployment_id": "run-xyz", │
│ "target": "cloud-gpu", │ ← still called "cloud-gpu" even for VPS
│ "gpu_provider": "hetzner", │ ← dispatch to Hetzner instead of Vast
│ "server_type": "cax11", │ ← Hetzner's server type codes
│ "location": "nbg1-dc3", │ ← datacenter location (or "hel1", "ash")
│ "onstart": "#!/bin/bash\n...", │ ← cloud-init script (optional)
│ "budget_usd": 50.00 │ ← fail-closed cost guard
│ } │
└─────────────────────────────────────────┘
↓ (AitherComet :8126, TLS)
Cloud router
↓
┌───────┴────────┐
↓ ↓
if gpu_provider (other)
== "hetzner"
↓
Provider dispatch
├─→ Vault: get_secret(HETZNER_API_KEY)
├─→ Hetzner API: list SSH keys
├─→ Hetzner API: create server
├─→ Poll for "running" status + SSH ready
└─→ return {instance_id, ssh_host, ssh_port, gpu_model="N/A", price_per_hour}
The provider returns an InstanceInfo object that AitherComet uses to:
- Record the deployment state to
AitherOS/Library/Data/comet/deployments.json
- Create tunnels or direct SSH access depending on your deployment strategy
- Attach the node to the mesh and register it with AitherDirectory
Prerequisites: SSH key and vault token
Step 1: Create or load an SSH keypair
If you don't have a keypair yet, generate one:
# Generate a 4096-bit RSA key (standard for cloud provisioning)
ssh-keygen -t rsa -b 4096 -f ~/.ssh/hetzner-provisioning -N ""
# Or: use an existing key
cat ~/.ssh/id_rsa.pub # ← the PUBLIC key (begins with "ssh-rsa ...")
Save the public key somewhere you won't lose it — you'll paste it into Hetzner's dashboard
or use the API to upload it. Do not commit the private key to git. Store it in your
vault if you need it retrievable:
# Store the private half in the vault. Note secret_type must be one of the
# service's known types -- api_key / token / password / certificate /
# private_key / connection_string / generic. Passing "ssh_key" is rejected,
# and the rejection surfaces only as a generic "failed to store".
from your_platform.secrets import SecretsClient # your own vault client
await SecretsClient().store(
"HETZNER_SSH_PRIVATE_KEY",
private_key_pem,
secret_type="private_key",
access_level="internal",
)
Step 2: Upload public key to Hetzner account
The key must exist in Hetzner Cloud account before you provision a server. Two paths:
Via REST API (for automation):
# Get your Hetzner API token (from https://console.hetzner.cloud/account/api-tokens)
export HETZNER_API_KEY="<your-token-here>"
# Upload the public key
curl -X POST https://api.hetzner.cloud/v1/ssh_keys \
-H "Authorization: Bearer $HETZNER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "provisioning-key",
"public_key": "ssh-rsa AAAA..."
}'
# Response: {id: 12345, name: "provisioning-key", public_key: "ssh-rsa AAAA...", labels: {...}}
Via dashboard (one-time, manual):
- Log in to console.hetzner.cloud
- Click SSH Keys (left sidebar)
- Click Add SSH Key
- Paste your public key and name it (e.g., "provisioning-key")
Step 3: Verify API token is in vault
AitherComet reads HETZNER_API_KEY from the vault at provisioning time. If you're self-
hosting, you must store it first:
from your_platform.secrets import SecretsClient # your own vault client
await SecretsClient().store(
"HETZNER_API_KEY", "<your-token-from-the-Hetzner-console>",
secret_type="api_key", access_level="internal",
)
Then prove the round-trip before relying on it — a write that 401s and a secret that
simply is not set look identical at every later call site:
from your_platform.secrets import get_secret # your platform's read helper
assert get_secret("HETZNER_API_KEY"), "vault readback failed"
Verify it was stored:
curl -X GET http://127.0.0.1:8111/secrets/HETZNER_API_KEY \
-H "X-API-Key: $YOUR_VAULT_API_KEY"
# Expected: 200 with secret object
Provisioning a server
Note (measured live 2026-08-18): AitherComet is published on host 8126
(container 8125). The port :8150 this runbook used to name is the LLM router;
every command here pointed at a service that could not answer it.
TRY BOTH SCHEMES — the scheme is NOT stable across restarts. On its first boot
this service logged Uvicorn running on a wildcard bind address and answered only
https://; after a restart the same container answered only http://, and the
HTTPS probes showed up in its own log as Invalid HTTP request received. Pinning
either spelling is a latent outage: the wrong one returns 000, which reads as
"the service is down" while it is Up (healthy) and serving. Probe http:// and
https:// and take whichever answers. For https://, pass the issuing CA with
--cacert <your-ca-bundle.pem> rather than -k: -k turns off certificate checking
entirely, which is tolerable for a bare reachability probe but never for a call that
carries a token.
If /deploy does not respond at all, check whether the unit is masked before
concluding the service is retired: a masked quadlet leaves no container, running or
stopped, so podman ps -a shows nothing and it looks like it was never deployed.
Use AitherComet's /deploy endpoint:
# The body carries a token, so build it in a private file from the environment
# (never paste the token into the command line, where `ps` and shell history see it)
# and send it only over https with the CA verified.
umask 077
cat > deploy-body.json <<EOF
{
"deployment_id": "model-inference-run-abc123",
"service_name": "inference-node",
"target": "cloud-gpu",
"gpu_provider": "hetzner",
"server_type": "cax11",
"location": "nbg1-dc3",
"budget_usd": 50.00,
"env_vars": {
"NODE_NAME": "inference-1",
"HF_TOKEN": "${HF_TOKEN}",
"MODEL": "meta-llama/Llama-2-7b"
},
"onstart": "#!/bin/bash\necho 'Server starting'\n"
}
EOF
curl -X POST https://127.0.0.1:8126/deploy --cacert <your-ca-bundle.pem> \
-H "Content-Type: application/json" \
--data @deploy-body.json
rm -f deploy-body.json
If the service is currently answering only plain http:// (see the note above), do not
send a body that contains a token: fix TLS first, or leave HF_TOKEN out.
Expected response (202 Accepted):
{
"deployment_id": "model-inference-run-abc123",
"status": "provisioning",
"service_name": "inference-node",
"started_at": "2026-07-27T14:22:45Z",
"metrics": {
"instance_id": "45621839",
"ssh_host": "161.156.70.45",
"ssh_port": 22,
"exposed_ports": {},
"gpu_model": "N/A",
"price_per_hour": 0.0065
},
"target": "cloud-gpu",
"message": "Provisioning instance on Hetzner..."
}
Poll the deployment status:
curl -X GET http://127.0.0.1:8126/deployments/model-inference-run-abc123
# Shows: status in [provisioning, starting, running, failed, destroyed]
Server types — read from GET /v1/server_types on 2026-07-27
Gross EUR, cheapest location. Verify against the API rather than trusting this table —
prices change and this is a snapshot, which is exactly why the numbers below carry a date.
| Type |
vCPU |
RAM |
Disk |
Arch |
€/mo |
€/hr |
Available in |
cx23 |
2 |
4GB |
40GB |
x86 |
6.49 |
0.0104 |
fsn1, hel1, nbg1 |
cax11 |
2 |
4GB |
40GB |
arm |
6.99 |
0.0112 |
fsn1, hel1, nbg1 |
cx33 |
4 |
8GB |
80GB |
x86 |
8.99 |
0.0160 |
fsn1, hel1, nbg1 |
cpx21 |
3 |
4GB |
80GB |
x86 |
10.99 |
0.0176 |
all six |
cax21 |
4 |
8GB |
80GB |
arm |
12.49 |
0.0200 |
fsn1, hel1, nbg1 |
cx43 |
8 |
16GB |
160GB |
x86 |
18.49 |
0.0296 |
fsn1, hel1, nbg1 |
cpx31 |
4 |
8GB |
160GB |
x86 |
20.49 |
0.0328 |
all six |
cax31 |
8 |
16GB |
160GB |
arm |
24.99 |
0.0400 |
fsn1, hel1, nbg1 |
cx53 |
16 |
32GB |
320GB |
x86 |
34.99 |
0.0561 |
fsn1, hel1, nbg1 |
cpx41 |
8 |
16GB |
240GB |
x86 |
37.99 |
0.0609 |
all six |
ccx13 |
2 |
8GB |
80GB |
x86 |
50.49 |
0.0809 |
all six (dedicated vCPU) |
The cx/cax line is cheaper but German-only. If you need a US location, your options
start at cpx21/cpx31 — that price gap is the cost of being close to your users, and it
is easy to miss because the cheap types simply do not appear in ash/hil at all.
ccx* are dedicated-vCPU (not shared) and cost roughly 2.5× the cpx equivalent; take
them only when you actually need predictable CPU. The most expensive type in the API is
ccx63 at €1006.99/mo — there is no €4.90/hr "bare metal" tier in this API.
Locations
Read from GET /v1/datacenters on 2026-07-27, with the count of server types each one
actually had available at that moment:
| Datacenter |
Where |
Types available |
nbg1-dc3 |
Nuremberg, DE |
12 |
hel1-dc2 |
Helsinki, FI |
12 |
sin-dc1 |
Singapore |
12 |
ash-dc1 |
Ashburn, VA, US |
10 |
hil-dc1 |
Hillsboro, OR, US |
10 |
fsn1-dc14 |
Falkenstein, DE |
0 |
Falkenstein was completely exhausted — not "some types unavailable", zero. It is also
the location most tutorials default to, so the first thing many people try is the one that
cannot work. Hetzner's standing "limited availability of cloud instances" advisory is real.
Treat capacity as a normal, expected failure, not an error state: pick a fallback
location list up front and walk it. Query availability rather than guessing:
GET /v1/datacenters -> .datacenters[].server_types.available (ids)
GET /v1/server_types -> map id -> name
Do not hammer the same location in a tight retry loop hoping capacity frees up. If a
datacenter reports zero available types, it will not change in the seconds you are willing
to wait — move to the next location instead.
Cost guard: fail-closed by design
The budget_usd field enforces a hard cap on estimated spend. AitherComet computes
worst-case price from available offers and blocks provisioning if it exceeds the cap.
This is intentional.
┌─ Worst-case price calculation ────────────────┐
│ Best offer: €0.0400/hr for cax31 │
│ Estimated duration: 4 hours (default) │ ← DEFAULT_ESTIMATED_HOURS
│ Price/hr in USD: €0.0400 * ~1.10 = ~$0.044 │ ← EUR->USD is approximate
│ Worst-case spend: $0.044 * 4 = ~$0.18 │
│ │
│ budget_usd: $50.00 │
│ $0.20 < $50.00 → ALLOWED ✓ │
└───────────────────────────────────────────────┘
If this guard fails, you get BudgetBlockedError: GPU rental blocked by quota. Causes:
- Quota exhausted: you''ve already provisioned instances totaling your budget; destroy
one or increase your cap in the request.
- Unpriced offer: a server type has no price data — the gate refuses it outright
($0/hr is impossible and looks like data corruption).
- High price spike: rare; Hetzner pricing shifts with supply. Increase
budget_usd
and retry.
This gate runs before instance creation and is the only thing that keeps a code bug
from spending real money on an infinite loop. Never remove it, never bypass it, never
stub it in tests.
Management: starting, stopping, destroying
Once provisioned, you manage the instance via /deployments/{id} endpoints:
# Get current status
curl -X GET http://127.0.0.1:8126/deployments/model-inference-run-abc123
# Stop (suspend without destroying) — keeps the instance and its data
curl -X POST http://127.0.0.1:8126/deployments/model-inference-run-abc123/stop
# Hetzner bills a powered-off server at the FULL hourly rate until it is deleted.
# Stopping saves nothing; only teardown (or snapshot, then delete) stops the charge.
# Start (resume from stopped state)
curl -X POST http://127.0.0.1:8126/deployments/model-inference-run-abc123/start
# Destroy (irreversible; data is gone)
curl -X POST http://127.0.0.1:8126/deployments/model-inference-run-abc123/teardown
# Hetzner immediately powers down and deallocates the instance.
# No backup, no recovery, no "are you sure?" — be sure before you send this.
⚠️ Destroying a server is permanent. You cannot retrieve its data after teardown.
If you need persistent state across deployments, use Object Storage (see below).
SSH access and debugging
Once the server is running, you have direct SSH access:
ssh -i ~/.ssh/hetzner-provisioning root@161.156.70.45
# (or whatever hostname was returned in the deployment metrics)
# The node auto-registers with AitherDirectory and becomes discoverable:
curl -X GET http://127.0.0.1:8001/directory/nodes \
| jq ''.[] | select(.hostname == "161.156.70.45")''
From inside the node, you can run workloads and they''ll have full mesh connectivity.
Optional: cold-tier object storage on Hetzner S3