CLI Command Reference
CLI Command Reference
For users who prefer command-line interaction, the Morph Cloud CLI provides a convenient way to manage resources.
morphcloud image
Manages Morph images.
-
morphcloud image list [--json]: Lists all available images.--json: Output in JSON format.
morphcloud image list
morphcloud image list --json
morphcloud snapshot
Manages Morph snapshots.
-
morphcloud snapshot list [--metadata KEY=VALUE ...] [--json]: Lists all snapshots.--metadata KEY=VALUE: Filters snapshots by metadata. You can provide multiple metadata filters.--json: Output in JSON format.
morphcloud snapshot list
morphcloud snapshot list --metadata environment=development --metadata region=us-west
morphcloud snapshot list --json -
morphcloud snapshot create --image-id IMAGE_ID --vcpus INT --memory INT --disk-size INT [--digest TEXT] [--json]: Creates a new snapshot.--image-id IMAGE_ID: ID of the base image (required).--vcpus INT: Number of vCPUs (required).--memory INT: Memory in MB (required).--disk-size INT: Disk size in MB (required).--digest TEXT: User-provided digest.--json: Output in JSON format.
morphcloud snapshot create --image-id img_your_image_id --vcpus 2 --memory 4096 --disk-size 50000
morphcloud snapshot create --image-id img_your_image_id --vcpus 2 --memory 4096 --disk-size 50000 --json -
morphcloud snapshot delete SNAPSHOT_ID: Deletes a snapshot.morphcloud snapshot delete snapshot_your_snapshot_id -
morphcloud snapshot get SNAPSHOT_ID: Gets details of a snapshot.morphcloud snapshot get snapshot_your_snapshot_id -
morphcloud snapshot set-metadata SNAPSHOT_ID KEY1=VALUE1 [KEY2=VALUE2 ...]: Sets metadata on a snapshot.morphcloud snapshot set-metadata snapshot_your_snapshot_id environment=production purpose="data processing"
morphcloud instance
Manages Morph instances.
-
morphcloud instance list [--metadata KEY=VALUE ...] [--json]: Lists all instances.--metadata KEY=VALUE: Filters instances by metadata.--json: Output in JSON format.
morphcloud instance list
morphcloud instance list --metadata application=webapp
morphcloud instance list --json -
morphcloud instance start SNAPSHOT_ID [--ttl-seconds INT] [--ttl-action {stop|pause}] [--json]: Starts a new instance from a snapshot.SNAPSHOT_ID: ID of the snapshot to start from.--ttl-seconds INT: Time-to-live in seconds for the instance.--ttl-action {stop|pause}: Action when TTL expires.--json: Output in JSON format.
morphcloud instance start snapshot_your_snapshot_id
morphcloud instance start snapshot_your_snapshot_id --ttl-seconds 3600 --ttl-action stop
morphcloud instance start snapshot_your_snapshot_id --json -
morphcloud instance stop INSTANCE_ID: Stops an instance.morphcloud instance stop instance_your_instance_id -
morphcloud instance pause INSTANCE_ID: Pauses an instance.morphcloud instance pause instance_your_instance_id -
morphcloud instance resume INSTANCE_ID: Resumes a paused instance.morphcloud instance resume instance_your_instance_id -
morphcloud instance get INSTANCE_ID: Gets details of an instance.morphcloud instance get instance_your_instance_id -
morphcloud instance snapshot INSTANCE_ID [--json]: Creates a snapshot from an instance.--json: Output in JSON format.
morphcloud instance snapshot instance_your_instance_id
morphcloud instance snapshot instance_your_instance_id --json -
morphcloud instance branch INSTANCE_ID [--count INT]: Branches an instance into multiple clones.--count INT: Number of clones to create (default: 1).
morphcloud instance branch instance_your_instance_id --count 5 -
morphcloud instance expose-http INSTANCE_ID NAME PORT [--auth-mode {none|api_key}]: Exposes an HTTP service.INSTANCE_ID: ID of the instance.NAME: Name of the service.PORT: Port to expose.--auth-mode {none|api_key}: Authentication mode (default: none).
morphcloud instance expose-http instance_your_instance_id my-service 8080
morphcloud instance expose-http instance_your_instance_id my-service 8080 --auth-mode none
morphcloud instance expose-http instance_your_instance_id secure-service 8081 --auth-mode api_key -
morphcloud instance hide-http INSTANCE_ID NAME: Hides an exposed HTTP service.morphcloud instance hide-http instance_your_instance_id my-service -
morphcloud instance exec INSTANCE_ID COMMAND...: Executes a command on an instance.morphcloud instance exec instance_your_instance_id uname -a
morphcloud instance exec instance_your_instance_id bash -c "ls -l /tmp && echo Hello" -
morphcloud instance set-metadata INSTANCE_ID KEY1=VALUE1 [KEY2=VALUE2 ...]: Sets metadata on an instance.morphcloud instance set-metadata instance_your_instance_id environment=staging region=eu-central-1 -
morphcloud instance ssh INSTANCE_ID [--rm] [--snapshot] [COMMAND...]: Starts an SSH session to an instance.--rm: Remove the instance after exiting SSH.--snapshot: Create a snapshot before exiting SSH.COMMAND...: Optional command to execute non-interactively.
morphcloud instance ssh instance_your_instance_id
morphcloud instance ssh instance_your_instance_id --rm
morphcloud instance ssh instance_your_instance_id --snapshot
morphcloud instance ssh instance_your_instance_id "ls -l /app" # Run command non-interactively -
morphcloud instance port-forward INSTANCE_ID REMOTE_PORT [LOCAL_PORT]: Forwards a port from an instance to your local machine.REMOTE_PORT: Remote port on the instance.LOCAL_PORT: Local port on your machine (optional, defaults toREMOTE_PORT).
morphcloud instance port-forward instance_your_instance_id 8080
morphcloud instance port-forward instance_your_instance_id 8080 9000 # Local port 9000 to remote 8080 -
morphcloud instance copy SOURCE DESTINATION [-r]: Copies files to or from a Morph instance.SOURCE: Source path (local path orinstance_id:/remote/path).DESTINATION: Destination path (local path orinstance_id:/remote/path).-r,--recursive: Copy directories recursively.
morphcloud instance copy morphvm_1234:/etc/config.json ./config.json
morphcloud instance copy ./local/file.txt morphvm_1234:/remote/path/
morphcloud instance copy -r ./local/dir morphvm_1234:/remote/dir/ -
morphcloud instance chat INSTANCE_ID [INSTRUCTIONS...]: Starts an interactive chat session with an instance (if LLM agent is integrated).morphcloud instance chat instance_your_instance_id
morphcloud instance chat instance_your_instance_id "Explain the file system layout"