Skip to main content

Pause / Resume

The pause and resume functionality allows you to temporarily suspend an instance while preserving its memory state, and later restart it exactly where it left off. This approach saves on compute costs compared to keeping an instance running while still preserving its state.

When to Use Pause vs Stop

  • Pause: Use when you need to preserve the running state of applications, the memory contents, and all processes. You'll only be charged for storage, not compute resources.
  • Stop: Use when you're completely done with the instance and want to release all resources. You'll lose the running state, but you can always start a new instance from a snapshot.

Pause an Instance

Pausing an instance suspends its execution while preserving the memory state. It's effectively the same as if you had snapshotted the instance.

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()

instance_id = "morphvm_abc123" # Replace with a valid instance ID
instance = client.instances.get(instance_id=instance_id)
instance.pause()

print(f"Instance '{instance_id}' paused.")

Resume an Instance

Resuming a paused instance restores it to its exact state at the time of pausing, with all processes and memory state intact.

from morphcloud.api import MorphCloudClient

client = MorphCloudClient()

instance_id = "morphvm_abc123" # Replace with a valid instance ID
instance = client.instances.get(instance_id=instance_id)
instance.resume()

print(f"Instance '{instance_id}' resumed.")

Cost Implications

When an instance is paused:

  • We create a new snapshot and suspend the VM
  • The VM stops consuming MCUs
  • You only get charged for the snapshot taken
  • Running processes/memory state preserved as usual

This makes pausing an economical way to temporarily suspend workloads that you'll need to resume later in the exact same state.