Documentation
DeploymentInfrastructure

Terraform

Provision a ready-to-use VPS on AWS, DigitalOcean, or Hetzner with the GoLiveKit provisioning CLI.

Use @golivekit/provision to generate and run the Terraform setup for a production VPS.

The CLI supports AWS (EC2), DigitalOcean, and Hetzner. It guides you through provider selection, creates the Terraform output folder, and provisions a server that is pre-configured for Docker-based deployment.

Prerequisites

Minimal Requirement for VPS

1 GB Ram / 1 CPU
25 GB SSD Disk

  1. Install Terraform.
  2. Make sure npx is available locally.
  3. Generate an SSH key pair, or have an existing public key ready.
  4. Prepare the API credentials for your cloud provider.

Quick start

Run the CLI from your terminal:

npx @golivekit/provision apply

This starts the interactive flow:

  • Select a provider
  • Choose where the generated Terraform project should be written
  • Optionally provide a custom cloud-init template
  • Review and apply the Terraform changes

If --out is omitted, the CLI prompts for an output directory and defaults to ./provision-out.

If --cloud-init is omitted, the CLI prompts for an optional custom template and otherwise uses the bundled default.

Common commands

Use the command that matches your workflow:

# Interactive apply
npx @golivekit/provision apply

# Write generated files to a specific directory and only show the plan
npx @golivekit/provision plan --out ./infra

# Apply using a custom cloud-init template
npx @golivekit/provision apply --out ./infra --cloud-init ./my-init.yaml

# Destroy the provisioned infrastructure
npx @golivekit/provision destroy --out ./infra

Output directory

The directory passed with --out contains the generated Terraform project, provider-specific variables, and local Terraform state.

Use a dedicated folder for each environment if you manage more than one server.

Examples:

./provision-out
./infra/staging
./infra/production

Custom cloud-init

By default, GoLiveKit uses the bundled cloud-init template. You can override it with --cloud-init if you need extra packages, users, files, or system configuration during first boot.

npx @golivekit/provision apply --out ./infra --cloud-init ./my-init.yaml

If you skip --cloud-init, the CLI asks whether you want to use a custom template and falls back to the default template when you do not provide one.

What the server gets

After Terraform finishes, the server boots and runs the cloud-init setup. Wait a few minutes while it automatically:

  • Updates system packages
  • Installs Docker and the Docker Compose plugin
  • Creates a dedicated deploy user
  • Configures a basic firewall with the required ports
  • Prepares the machine for Docker-based app deployment

Connect to the server

After the apply step completes, Terraform prints the public IP address of the new machine.

Use it to connect over SSH:

ssh deploy@<server_public_ip>

From there, you can continue with your Docker VPS deployment flow.

Tear it down

npx @golivekit/provision destroy --out ./infra

Run destroy from the same output directory you used for the original apply so Terraform can find the correct state.

On this page