Skip to main content
JavaScript examples use @beamcloud/beam-js 1.1.0 or later. Configure the SDK before running them.

CPU, memory, and root disk

VMs are CPU-only. Resource availability depends on the microVM serverless pool. You normally do not need --pool; use it to select a CPU microVM pool you have access to. Choose CPU, memory, root disk size, and image when creating the VM. beam vm update changes idle behavior and metadata, not the machine’s allocation or root disk capacity. See storage for what df -h / reports.

Names and IDs

Names are unique within a workspace. A name must begin with a lowercase letter and contain at most 24 lowercase letters, digits, or hyphens. Omit the name for a generated name such as calm-fox-5959d8. The VM also has an immutable ID such as vm-0123456789abcdef. Use its name or ID with beam vm get, start, stop, and other commands. A VM’s current container ID may change when it restarts; use the VM identity when reconnecting.

Base images

VM images require Debian or Ubuntu. The default is Ubuntu 24.04 (Noble). Existing VMs, snapshots, templates, and prebuilt images keep their OS and packages; create a new VM to use the new default. Ubuntu 24.04 provides Python 3.12 through apt. For project packages, install python3-venv and use a virtual environment instead of modifying the system Python environment.
The browser desktop supports Ubuntu 24.04 (noble) and Ubuntu 22.04 (jammy). Use the default image for desktop VMs. Alpine and other distributions without the supported apt/systemd setup are not supported VM bases.

Build a custom image

Create a Dockerfile with the tools you need:
Dockerfile
Create a VM directly from the Dockerfile:
Or build a reusable VM image first:
Use beam vm image build --desktop when the image will provide a desktop. An --image-id must already include the VM services; Beam cannot append packages to an existing immutable image ID, including an arbitrary sandbox image ID. Both SDKs accept an Image:
Use systemd units to start services at boot. VMs boot systemd and do not run the Dockerfile’s CMD as an application service.

Environment variables and secrets

Pass ordinary configuration with repeatable --env flags. Runtime secrets require approved credential hosts; bind them by name:
The guest receives a placeholder instead of the secret value. The worker replaces it with the value only in HTTPS headers sent to approved hosts. Value updates take effect on the next request after the worker’s 15-second cache expires, without restarting the VM. An explicit network allowlist must cover every credential host; with --block-network, only bound credential hosts are reachable. See VM secrets for guest requests, network rules, rotation, and client compatibility. Beam does not inject a workspace token into the guest. Bind BETA9_TOKEN or BEAM_TOKEN explicitly as a secret to run Beam tools inside the VM; these opt-ins expose the token in plaintext. Other names beginning with BEAM_VM_ or BETA9_ are reserved. Use --build-secret NAME for image-build secrets, which expose plaintext values during the build and are separate from runtime bindings.

Additional storage

Attach a named disk or shared workspace volume for data that should persist independently of the VM’s root disk:
Additional VM disks use the qcow driver and ext4. Disk names cannot begin with vm-, which is reserved for VM roots. Mount paths must be unique absolute paths, must not overlap, and cannot replace /, /dev, /proc, /sys, /run, or /.beam. These mounts are separate from the root snapshot. Read snapshot and fork boundaries before using them in a reusable environment.

Metadata and creation retries

Use metadata to label environments and filter the VM list:
An update replaces the complete metadata map. Metadata is visible in management responses; keep credentials in secrets. For creation retries, pass the same UUID as --request-id, request_id in Python, or requestId in JavaScript, with the same creation options. Reusing that request ID with a changed request is rejected. Reusing the same prepared Python VM object retains its request ID and prepared image, so a lost response can be retried without creating another VM. When creating from a template or snapshot, omitted configuration inherits the saved specification. Explicit settings override it. Choose one image source: registry image, image ID, Dockerfile, or template.