Skip to main content

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.

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()

Next steps