Disposable CI Runners on Hourly VPS Servers
Hosted CI minutes get expensive for heavy builds, and an always-on build server sits idle most of the day. A third option: create a server for the job, then destroy it. With hourly billing you pay only for the time it ran.
The idea
- Your pipeline calls the API to create a server.
- It waits until the server is active, then connects over SSH.
- It runs the build or test job.
- It destroys the server — billing stops right there.
Create the server
curl -s -X POST https://api.kvantis.org/api/v1/servers \
-H "Authorization: Bearer $KVANTIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"planId":"vc2-4c-8gb","regionId":"ams","osId":2284,"label":"ci-runner"}'
The response contains the server's id. Plan, region and OS ids come from GET /api/v1/catalog/plans, /catalog/regions and /catalog/os.
Send an Idempotency-Key header with a unique value per job: if the network drops and your script retries, you get the same server back instead of a second one.
Wait until it's ready
curl -s https://api.kvantis.org/api/v1/servers/$ID \
-H "Authorization: Bearer $KVANTIS_API_KEY"
Poll every few seconds until the status is active and the IPv4 is set — usually about a minute.
Bootstrap it with cloud-init
Pass a cloud-init script in the userData field of the request to install your toolchain and your CI system's SSH key at first boot. The server comes up ready to build.
Always clean up
curl -s -X DELETE https://api.kvantis.org/api/v1/servers/$ID \
-H "Authorization: Bearer $KVANTIS_API_KEY"
Run this in an always / finally step so a failed build doesn't leave a server running. Add a nightly job that lists servers labelled ci-runner and destroys any older than a few hours — a safety net for anything that slipped through.
Keep the key safe
Store the API key as a CI secret, never in the repository. Keep the balance funded; the API refuses new servers when it can't cover them.
Is it worth it?
For short, heavy jobs — big compiles, integration tests, Docker image builds — a Turbo or Titan for 20 minutes costs a small fraction of a monthly server, and builds far faster than a shared runner.
Get an API key and build on demand.