Save VM state to S3 and restore it on-demand or automatically via auto-wake
Snapshots let you pause a running VM and save its entire state (memory, CPU, disk) to S3 storage. You can restore the snapshot later to resume exactly where you left off.
S3 is required for snapshots. If S3 is not configured, snapshot requests will fail. The API will return an error indicating that snapshot storage is unavailable.
Snapshots are non-blocking from the API perspective, but the VM will be paused during the snapshot process (typically 1-5 seconds). For VMs with large memory allocations, upload time may be longer.
Restore is fast! Since memory and CPU state are preserved, the VM doesn’t go through a boot process. Typical restore time is 2-10 seconds depending on memory size.
Hatch can automatically restore snapshotted VMs when they receive HTTP traffic via the reverse proxy. See the Reverse Proxy guide for details.When a proxy route has auto_wake: true (default):
Incoming HTTP request hits the proxy
Proxy detects VM is in snapshotted state
VM is automatically restored from the latest snapshot
Request is forwarded once VM is running
This enables serverless-style workflows where VMs are paused when idle and wake instantly on demand.
While TCP connections are restored at the kernel level, most application-level connections (HTTP, SSH, database) will time out during the snapshot period. Design your applications to handle reconnections.
Before applying system updates, deploying new code, or making configuration changes, create a manual snapshot:
curl -X POST https://api.hatch.example.com/vms/vm-abc123/snapshot \ -H "Authorization: Bearer YOUR_API_KEY"
2
Test restore process
Periodically test restoring snapshots to ensure they work correctly:
# Snapshot the VMcurl -X POST https://api.hatch.example.com/vms/vm-abc123/snapshot \ -H "Authorization: Bearer YOUR_API_KEY"# Wait for snapshot to completesleep 10# Restore from snapshotcurl -X POST https://api.hatch.example.com/vms/vm-abc123/restore \ -H "Authorization: Bearer YOUR_API_KEY"
3
Monitor S3 storage costs
Snapshots consume S3 storage. Monitor your bucket size and implement retention policies:
# List all snapshots for a VMcurl https://api.hatch.example.com/vms/vm-abc123/snapshots \ -H "Authorization: Bearer YOUR_API_KEY"
4
Use auto-wake for cost savings
Enable auto-wake on proxy routes to automatically snapshot idle VMs and restore them on demand: