Snapshots
Snapshots capture the state of a running sandbox, including the filesystem and installed packages. Use snapshots to skip setup time on subsequent runs.
- Faster startups: Skip dependency installation by snapshotting after setup.
- Checkpointing: Save progress on long-running tasks.
- Sharing environments: Give teammates an identical starting point.
Call snapshot() on a running sandbox:
Once you create a snapshot, the sandbox shuts down automatically and becomes unreachable. You don't need to stop it afterwards.
# Create a snapshot of a running sandbox
sandbox snapshot sb_abc123 --stop
# Create a snapshot that expires in 14 days
sandbox snapshot sb_1234567890 --stop --expiration 14d
# Create a snapshot that never expires
sandbox snapshot sb_1234567890 --stop --expiration 0The --stop flag confirms that the sandbox will be stopped when snapshotting. By default, snapshots expire after 30 days. Use --expiration (e.g. --expiration 14d) to set a custom expiration time, or --expiration 0 to never expire the snapshot.
Pass the snapshot ID when creating a new sandbox:
sandbox create --snapshot snap_abc123View all snapshots for your project:
# List snapshots for the current project
sandbox snapshots list
# List snapshots for a specific project
sandbox snapshots list --project my-appLook up a snapshot by ID:
The CLI doesn't support retrieving a single snapshot by ID. Use sandbox snapshots list to view all snapshots for your project:
sandbox snapshots listRemove snapshots you no longer need:
# Delete a single snapshot
sandbox snapshots delete snap_abc123
# Delete multiple snapshots
sandbox snapshots delete snap_abc123 snap_def456- Snapshots expire after 30 days by default
- You can define a custom expiration time or none at all when creating a snapshot. See the SDK and CLI documentation for more details.
- See Pricing and Limits for storage costs and limits
Was this helpful?