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
- Install Terraform.
- Make sure
npxis available locally. - Generate an SSH key pair, or have an existing public key ready.
- Prepare the API credentials for your cloud provider.
Quick start
Run the CLI from your terminal:
npx @golivekit/provision applyThis 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 ./infraOutput 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/productionCustom 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.yamlIf 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
deployuser - 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 ./infraRun destroy from the same output directory you used for the original apply so Terraform can find the correct state.