VMs

Whole machines with their own operating system, reached over SSH.

Overview

A VM is a whole computer with its own operating system, running on this one at near-native speed. You log in over SSH, and it joins your private networks like any other resource.

Use it for software that doesn’t fit in a container, or when you want a full Linux machine to work on.

When to use it

  • Software that needs its own kernel or a full operating system.
  • A machine to log into and work on.
  • Testing in isolation from everything else.

How it works

QEMU 8+
One QEMU process per VM on the host, for the host’s own architecture: hardware acceleration with Hypervisor.framework on macOS and KVM on Linux. No emulation.
QMP
The control plane starts, stops and snapshots VMs over QEMU’s machine protocol.
Link container
Each VM has a small container in its network that carries its private address and name; Ethernet frames travel between it and the VM.
cloud-init
Your SSH keys and network settings reach the VM at first boot.
qcow2 disks
Thin disk files: a 50 GiB disk takes what is written.

The VM’s identity on the network — its address, its private name <name>.vm.internal, its published SSH port — belongs to its link container, so networks, subnets and firewalls apply to it exactly as to a container.

QEMU’s network card connects to the link container, which moves frames to and from the network. The VM itself sees one simple network set up by cloud-init.

Architecture

VMs architectureA VM’s network identity lives in a link container; QEMU runs the machine itself.SSHby nameframesYou, over SSHpublished portApps in the networkLink containerdev.vm.internal ·private IPQEMU processHVF or KVMDiskqcow2 volume
A VM’s network identity lives in a link container; QEMU runs the machine itself.
  • You, over SSH to Link container: SSH
  • Apps in the network to Link container: by name
  • Link container to QEMU process: frames
  • QEMU process to Disk

Flows

Creating a VM

  1. EnclaveStack fetches the image (or uses a snapshot) and makes the VM’s disk.
  2. It starts the link container in the VM’s network.
  3. It starts QEMU with cloud-init carrying your SSH keys.
  4. Once it answers, the page shows the SSH command.

Set it up

In the console

  1. Open VMs and choose New VM.
  2. Choose an image, CPUs and memory.
  3. Paste your SSH public key.
  4. Choose Create; its page shows how to log in.

With the CLI

enclave vm create dev --image debian-12 --ssh-key ~/.ssh/id_ed25519.pub --wait

With OpenTofu

OpenTofu configuration
resource "enclave_vm" "dev" {
  name     = "dev"
  image    = "debian-12"
  ssh_keys = [file(pathexpand("~/.ssh/id_ed25519.pub"))]
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_vm
NameTypeUseWhat it does
imagetextrequiredubuntu-24.04, debian-12, an https:// URL of a cloud image, or snapshot/NAME.
nametextrequiredName of the VM: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the VM.
cpusnumberoptionalCPUs, 1–16 (default 1). A change restarts the VM.
disk_gibnumberoptionalRoot disk in GiB (default 10); it only grows, live.
diskslist of textoptionalDisk volumes to attach, in order. A change restarts the VM.
image_sha256textoptionalSHA-256 of a URL image.
machinetextoptionalThe machine to run on (default: EnclaveStack chooses, and this reads back its choice). Changing it moves the resource, with its data, in place; apply waits for the move.
machine_labelsmap of textoptionalLabels the machine must have, when machine isn't set (key=value, all must match).
memory_mibnumberoptionalMemory in MiB, 512–65536 in steps of 128 (default 1024). A change restarts the VM.
networktextoptionalNetwork to place it in (default: the default network). Changes in place.
powertextoptionalrunning (default) or stopped.
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
publishlist of numbersoptionalVM ports published on the same host port (not 22).
ssh_key_secrettextoptionalA secret holding public keys, one per line.
ssh_keyslist of textoptionalOpenSSH public keys (or ssh_key_secret).
subnettextoptionalSubnet of the network (default: its first).
user_datatextoptionalFirst-boot script: #cloud-config or #!...; runs once.
idtextoutputResource ID.
private_dnstextoutputName the VM answers to inside its network: <name>.vm.internal.
private_iptextoutputThe VM's address in its network.
ssh_addresstextoutputWhere SSH answers on this machine, 127.0.0.1:PORT; the user is ssh_user.
ssh_usertextoutputThe user with your keys and sudo: enclave.

Limits and security

Good to know

  • Needs QEMU 8 or later on the machine; the console says how to install it if it’s missing.
  • A running VM keeps its memory reserved, idle or not.

Security

  • Logins use your SSH keys; no password is set.
  • Firewalls apply to its link container, and so to the VM.