Skip to main content

Boot Instance from Snapshot

Boot starts a brand-new VM from a snapshot's disk image (a cold boot). It restarts the operating system and does not preserve any in-memory process or other volatile state. Use boot when you want to change the machine configuration (vCPU, memory, disk) or create fresh instances from a snapshot. If you want to restore memory and running process state from a saved snapshot, use instance start instead.

Boot Instance from Snapshot

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()

# Boot instance from snapshot with default settings
snapshot_id = "snapshot_your_snapshot_id" # Replace with a valid snapshot ID
instance = client.instances.boot(snapshot_id=snapshot_id)

print(f"Instance ID: {instance.id}")
print(f"Instance Status: {instance.status}")

Boot with Custom Resource Specifications

You can override the snapshot's default resource specifications when booting:

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()

snapshot_id = "snapshot_your_snapshot_id" # Replace with a valid snapshot ID

# Boot with custom resource specifications
instance = client.instances.boot(
snapshot_id=snapshot_id,
vcpus=4, # Override CPU cores
memory=4096, # Override memory (MB)
disk_size=20480, # Override disk size (MB)
)

print(f"Instance ID: {instance.id}")
print(f"vCPUs: {instance.spec.vcpus}")
print(f"Memory: {instance.spec.memory}MB")
print(f"Disk Size: {instance.spec.disk_size}MB")

Boot with Time-to-Live (TTL) Settings

Set automatic expiration for instances by configuring TTL settings:

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()

snapshot_id = "snapshot_your_snapshot_id" # Replace with a valid snapshot ID

# Boot instance with TTL settings
instance = client.instances.boot(
snapshot_id=snapshot_id,
ttl_seconds=3600, # Instance expires in 1 hour
ttl_action="pause" # Pause instead of stop when TTL expires
)

print(f"Instance ID: {instance.id}")
print(f"TTL: 1 hour (will be paused when expired)")

Best Practices

  • Verify snapshot exists before attempting to boot
  • Set appropriate TTL to avoid unexpected costs
  • Use custom resources only when necessary
  • Monitor boot status for mission-critical instances
Files missing after boot?

If new files don’t show up after booting from a snapshot, run Linux sync inside the VM before creating the snapshot to flush pending writes:

# inside the VM (or via exec)
sudo sync

Booting from snapshots provides a quick way to create instances with pre-configured disk state, ideal for scaling applications and resizing into different resources. For restoring active memory/process state, prefer instance start.