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. Under the hood, Morph creates an internal (hidden) snapshot/checkpoint so the instance can be resumed later. This hidden snapshot won’t appear in your normal snapshot list—if you want a user-visible snapshot you can manage directly, create one explicitly with instance.snapshot().
- Python
- TypeScript
- CLI
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.")
import { MorphCloudClient } from 'morphcloud';
const client = new MorphCloudClient();
async function pauseInstance() {
const instance_id = "morphvm_abc123"; // Replace with a valid instance ID
const instance = await client.instances.get({ instance_id: instance_id });
await instance.pause();
console.log(`Instance '${instance_id}' paused.`);
}
pauseInstance();
# Pause an instance
morphcloud instance pause morphvm_abc123
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.
- Python
- TypeScript
- CLI
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.")
import { MorphCloudClient } from 'morphcloud';
const client = new MorphCloudClient();
async function resumeInstance() {
const instance_id = "morphvm_abc123"; // Replace with a valid instance ID
const instance = await client.instances.get({ instance_id: instance_id });
await instance.resume();
console.log(`Instance '${instance_id}' resumed.`);
}
resumeInstance();
# Resume a paused instance
morphcloud instance resume morphvm_abc123
Cost Implications
When an instance is paused:
- We create an internal (hidden) snapshot/checkpoint and suspend the VM
- The VM stops consuming MCUs
- You only get charged for the storage footprint of the paused state
- 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.