First Success (5–10 minutes)
This guide gets you to a working Morph Cloud instance and your first successful command run.
1) Install the SDK (or CLI)
Follow the SDK Installation guide.
2) Set your API key
Follow API Keys and export MORPH_API_KEY.
3) Create a snapshot, start an instance, run a command
This is the smallest “end-to-end” flow.
- Python
- TypeScript
- CLI
from morphcloud.api import MorphCloudClient
client = MorphCloudClient()
snapshot = client.snapshots.create(
image_id="morphvm-minimal",
vcpus=1,
memory=1024,
disk_size=10000,
)
instance = client.instances.start(snapshot_id=snapshot.id)
instance.wait_until_ready()
result = instance.exec(command="echo 'Hello, Morph Cloud!'")
print(result.stdout)
instance.stop()
import { MorphCloudClient } from 'morphcloud';
async function main() {
const client = new MorphCloudClient();
const snapshot = await client.snapshots.create({
imageId: "morphvm-minimal",
vcpus: 1,
memory: 1024,
diskSize: 10000,
});
const instance = await client.instances.start({ snapshotId: snapshot.id });
await instance.waitUntilReady();
const result = await instance.exec(\"echo 'Hello, Morph Cloud!'\");
console.log(result.stdout);
await instance.stop();
}
main().catch(console.error);
SNAPSHOT_ID=$(
morphcloud snapshot create --image-id morphvm-minimal --vcpus 1 --memory 1024 --disk-size 10000 --json \\
| jq -r '.id'
)
INSTANCE_ID=$(morphcloud instance start \"$SNAPSHOT_ID\" --json | jq -r '.id')
morphcloud instance exec \"$INSTANCE_ID\" echo \"Hello, Morph Cloud!\"
morphcloud instance stop \"$INSTANCE_ID\"
Next steps
- Learn the model: Concepts → Mental model
- Manage instance lifecycle: Instance Management
- Expose a service: HTTP Services