Skip to main content
Create named sets of environment variables and inject them into VMs at creation time. Variables are written to /etc/environment and /etc/profile.d/machine0-env.sh via cloud-init.
machine0 env new production
machine0 env set production DATABASE_URL=postgres://... REDIS_URL=redis://...
machine0 new my-vm --env production

env ls

machine0 env ls
machine0 env ls --json

env get

Show env set details and variables.
machine0 env get <name>

env new

machine0 env new <name>
Creates an empty env set. Add variables with env set.

env set

Add or update variables in an env set.
machine0 env set <name> <KEY=VALUE...>
machine0 env set production DATABASE_URL=postgres://localhost/mydb
machine0 env set production API_KEY=sk_live_123 LOG_LEVEL=info
Keys must be valid POSIX names (A-Z, a-z, 0-9, _, starting with a letter or underscore). Values cannot contain newlines, carriage returns, double quotes, or null bytes.

env unset

Remove variables from an env set.
machine0 env unset <name> <KEY...>
machine0 env unset production LOG_LEVEL DEBUG

env rm

Delete an env set.
machine0 env rm <name>
VMs that were created with the deleted env set are not affected — variables are baked in at creation time.

Limits

LimitValue
Variables per set100
Sets per user50
Value size4 KB
Total set size64 KB

How injection works

Variables are injected once at VM creation via cloud-init into two files. Both are needed because Linux reads environment variables from different places depending on context:
  • /etc/environment — read by PAM and systemd (services, cron jobs, non-login sessions)
  • /etc/profile.d/machine0-env.sh — sourced by login shells (SSH sessions)
Updating an env set after creation does not affect already-running VMs.
Env sets are not supported with NixOS images yet. NixOS uses declarative Nix configuration instead of cloud-init.