First Success (5–10 minutes)
This guide gets you to a working Morph Devbox (recommended) and your first successful command run.
Devboxes are the best fit for:
- Development: VSCode/Cursor + tmux integration for CLI agents, plus fast branching for “many workspaces”
- Prototyping: expose an interactive preview URL for a web app or API; optionally disable auto-sleep to behave like a persistent VPS
- Sharing & collaboration: share a live devbox via URL inside your Morph Cloud organization
If you want finer-grained VM control and direct snapshot manipulation for advanced use cases (e.g. RL environments or test-time scaling), see the Infrastructure primitives flow below.
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) Recommended: start a Devbox, run a command, expose a preview
This is the smallest “end-to-end” Devboxes flow: create a devbox, run a command, and expose an HTTP preview URL.
- CLI (recommended)
- Dashboard
# 1) Pick a template and start a devbox
morphcloud devbox template list
TEMPLATE_ID="<pick-a-template-id>"
DEVBOX_ID=$(
morphcloud devbox start "$TEMPLATE_ID" --json | jq -r '.id'
)
echo "Devbox: $DEVBOX_ID"
# 2) Run a command in your devbox (via SSH)
morphcloud devbox ssh "$DEVBOX_ID" echo "Hello from a Morph Devbox!"
# 3) Start a tiny web server (in the background) and expose it publicly
morphcloud devbox ssh "$DEVBOX_ID" bash -lc "nohup python3 -m http.server 3000 >/tmp/http.log 2>&1 &"
morphcloud devbox expose-http "$DEVBOX_ID" --name app --port 3000
- Create a devbox: https://cloud.morph.so/web/devboxes/new
- Open it in VSCode or Cursor (one click in the Devboxes UI)
- Start any local web server inside the devbox (e.g.
python3 -m http.server 3000) - Use Live Preview / HTTP exposure to get a shareable URL
Tip: Share the devbox or its exposed URL with teammates inside your organization.
4) Advanced: infrastructure primitives (instances + snapshots)
This is the VM primitives path. It’s great for power users who want direct control over VMs and snapshots.
- 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
- Devboxes (recommended): Getting started
- VM primitives: Instance Management