Create Volume Snapshots
Learn how to create and use volume snapshots for backup and recovery
Using the TypeScript SDK
Volume snapshots allow you to create point-in-time backups of your volumes. Snapshots capture the entire state of a volume at a specific moment, enabling you to restore data, clone volumes, or create multiple sandboxes with identical data.
Benefits of Volume Snapshots
- Backup and Recovery: Create backups before making significant changes or updates
- Point-in-Time Recovery: Restore volumes to a previous state if something goes wrong
- Volume Cloning: Create new volumes from snapshots to duplicate data across multiple sandboxes
- Experiment Safely: Take snapshots before experiments, allowing quick rollback if needed
- Data Sharing: Share volume states by creating snapshots that others can use
Step 1: Create a Snapshot
Create a snapshot of an existing volume:
Step 2: Use Snapshot to Create Sandbox
When creating a sandbox, you can use a snapshot ID as the volume_id. This automatically creates a new volume from the snapshot and attaches it to the sandbox:
Each sandbox created with a snapshot ID gets its own independent copy of the snapshot data, allowing you to clone volumes across multiple sandboxes.
Complete Example: Backup and Restore Workflow
Here’s a complete example demonstrating a backup and restore workflow:
Use Case: Cloning Volumes for Parallel Processing
Snapshots are useful when you need to create multiple sandboxes with identical data for parallel processing:
Best Practices
- Snapshot Before Major Changes: Always create snapshots before making significant modifications to your data
- Regular Backups: Schedule regular snapshots for critical volumes
- Name Your Snapshots: Use descriptive names to identify snapshot purposes
- Clean Up Old Snapshots: Delete snapshots you no longer need to manage storage costs
- Test Restores: Periodically test restoring from snapshots to ensure they work correctly
Response Structure
The createSnapshot() method returns a VolumeCreateSnapshotResponse object:
Parameters
A descriptive name for your snapshot
Next Steps
- Learn how to list volumes to see your snapshots
- Explore creating sandboxes with snapshot-based volumes
- Check the API Reference for all snapshot operations