Skip to content

Snapshots

Interactive runtimes with snapshots.

Build with agents
On this page

Let’s start with some terminology:

A beam runtime is an ephemeral micro-VM that expires in 11 hours. Each beam has an identity, state and a virtual network. A phase is a versioned and layered images for beam runtimes. A phase holds filesystem state and its build instructions.

A beam runtime and phases.

Beam runtimes and phases.

Beam runtime Ephemeral micro-VM Phase foundation
Phase reference
Phase Versioned image with layers

You can combine beams and phases to create reusable images, create forks and snapshots. Let’s start an interactive build beam micro-VM that supports snaphots in /home folder.

Install the client tools and sign in

Beams is a Teleport project and uses official Teleport client tools.

The client tools include tsh to sign in and run commands, and tctl to administer your cluster if you have permission.

Cluster: example.beams.run. Edit this example to use your cluster name.

Install version 18.11.10 of the client:

Operating system
macOS

Download and open the macOS installer, then follow its instructions.

CLI
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkg
Linux

For Linux x86-64, download and install the client tools:

CLI
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/install
Windows

For Windows x86-64, run these commands in PowerShell. Add the extraction directory ($env:LOCALAPPDATA\Teleport) to your user PATH to use tsh in future terminals; the last command adds it to this terminal's PATH.

PowerShell
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"

Follow the official client tools install guide for other versions and architectures.

Check that you’re running v18.11.10 of the client with tsh version.

CLI
tsh version
Sign-in method
Passwordless

I sign in without a password (e.g. a passkey).

CLI
tsh login --proxy='example.beams.run' --auth=passwordless
Password & MFA

I have a password & MFA set up for my account:

Replace you@example.com with your Teleport username.

CLI
tsh login --proxy='example.beams.run' --user=you@example.com
SSO

I sign in with SSO (e.g. Okta, GitHub, SAML).

CLI
tsh login --proxy='example.beams.run'

Start a beam

CLI · Local terminal
tsh phase add workspace

This command created the build beam and an associated phase with the same name. You can snaphshot versions in /home folder of this beam, and phase workspace will add layer on each snapshot. Let’s give it a try:

CLI · Build beam: workspace
mkdir -p ~/app
printf '<h1>Hello from my workspace</h1>\n' > ~/app/index.html

Snapshot

CLI · Build beam: workspace
tsh phase snapshot

This saves filesystem changes since the last edit and updates the associated phase workspace.

Once you are done, you can finalise the changes to the workspace phase.

CLI · Build beam: workspace
tsh phase snapshot --final

This command finalises the phase, shuts down and discards the build beam.

If you disconnect from the beam and did not run tsh phase snapshot --final, the changes will not be saved. To reconnect back, use tsh beams ssh workspace.

Return to saved work

To start a new build beam, run:

CLI · Local terminal
tsh phase edit workspace

A fresh build beam contains the last saved filesystem of workspace.

Edit your files and run tsh phase snapshot --final inside that beam to save again.

When a snapshot is rejected

The default snapshot fails if you changed files outside the allowed paths. Inspect the rejected paths before deciding to omit them:

CLI · Build beam: workspace
tsh phase snapshot --force

--force leaves the running filesystem unchanged but excludes disallowed changes from the saved image. Those changes are lost when the beam is removed. See the snapshot exclusions.

For repeatable setup, copy stages, startup services, and phase.yaml, use the phase API reference.

When an edit is unavailable

You cannot start a second edit while a phase has an active build. Reconnect to that build with tsh beams ssh, or finish it before starting another.

You also cannot edit or save changes to a snapshot phase while it has snapshot descendants. This includes indirect descendants and snapshot builds still in progress. Rebuild and copy children alone do not prevent editing.

If descendants prevent an edit, fork the saved snapshot into a new phase:

CLI · Local terminal
tsh phase add workspace-v2 --fork-from=workspace

The original and its dependents keep their existing contents and relationship.

You can read more on forks here.

Saving, disconnecting, and ending a build

Action Result
tsh phase snapshot inside the build beam Saves allowed filesystem changes and keeps the beam running.
tsh phase snapshot --final inside the build beam Saves successfully, then ends the build beam. Changes after capture are discarded.
exit or Ctrl-D in the shell Disconnects. It does not save files or end the beam.
tsh beams ssh <build-beam> from your local terminal Reconnects to the existing running workspace, including unsaved changes.
tsh phase edit <phase> after the build ends Creates a fresh build beam from the phase’s last successful snapshot.
beam expiry or tsh beams rm <build-beam> Removes the beam and discards unsaved changes. The phase’s last saved image remains available.

Build beams expire after 11 hours. Check tsh beams ls for the expiry and identifier of a running beam. Save before that deadline. Expiry does not capture a final snapshot.

Search docs

Loading search and AI…

Skills

Install all available skills. All Beams and Teleport skills are hosted in our OSS Teleport repository.

npx skills add https://github.com/gravitational/teleport