Skip to content

Snapshots

Snapshots let you create a point-in-time capture of a running sandbox, including its in-memory execution state and writable disk state.

You can then restore that snapshot into a brand new sandbox that starts from the same checkpoint.

  • Snapshots are created from a running sandbox.
  • The VM is paused while the snapshot is taken and uploaded.
  • POST /v1/sandbox/{sandboxID}/snapshot/create resumes the source sandbox after the snapshot finishes.
  • POST /v1/sandbox/{sandboxID}/snapshot/pause creates a named snapshot and then terminates the source sandbox.
  • POST /v1/sandbox/{sandboxID}/pause pauses the sandbox without creating a named snapshot. See Sandboxes.
  • If you omit name, Leap0 generates one from the template name.
Running sandboxPaused sandboxSnapshot createdRestored sandboxsource sandbox stays running pause into snapshotcreate snapshot restore snapshotrestore snapshot

Restoring a snapshot creates a brand new sandbox.

  • Compute settings come from the snapshot, not the restore request.
  • The snapshot’s template is reattached automatically.
  • timeout_min can be overridden when restoring.
  • auto_pause can be enabled when restoring if you want the new sandbox to pause itself at timeout.
  • network_policy defaults to the snapshot values, but you can override it on restore.
  • Restore requests address snapshots by snapshot_name.
from leap0 import Leap0Client
client = Leap0Client()
sandbox = client.sandboxes.create()
snapshot = client.snapshots.create(sandbox, name="workspace-warm")
print(snapshot.id, snapshot.name)

Use this when you want to create a named snapshot and shut the sandbox down immediately after the snapshot is stored.

The response includes the snapshot details and confirms the sandbox state is paused.

from leap0 import Leap0Client
client = Leap0Client()
sandbox = client.sandboxes.create()
snapshot = client.snapshots.pause(sandbox, name="workspace-warm")
print(snapshot.id, snapshot.name)
from leap0 import Leap0Client, NetworkPolicyMode
client = Leap0Client()
sandbox = client.snapshots.resume(
snapshot_name="workspace-warm",
auto_pause=True,
timeout_min=30,
network_policy={
"mode": NetworkPolicyMode.CUSTOM,
"allow_cidrs": ["1.2.3.4/32"],
},
)
print(sandbox.id, sandbox.state)

When a snapshot is deleted, all stored data for that sandbox (memory state, disk state) is permanently removed.

from leap0 import Leap0Client
client = Leap0Client()
client.snapshots.delete("<snapshot_id>")