Run your first machine
Create a sandbox machine, run a command in it, and clean up.
This guide takes you from nothing to a running machine you can run commands in. It takes about two minutes.
What you'll learn
- How to pick an image and a region
- How to create and start a machine
- How to run commands and move files
- How to delete a machine
Before you start
- Install the CLI and sign in
- For the SDK part, create an API key
With the CLI
Pick a region
List the regions you can run machines in and note an identifier such as iad1:
Pick an image
Metorial manages a set of images for common stacks: Debian, Alpine, Node.js, Bun, Deno, Python, Go, Java, PHP, .NET, and images with browser automation preinstalled. Find one and copy its ID (sbi_...):
Create the machine
Machines start right away unless you pass --start=false. Without a size, the machine gets the default size.
Save the machine ID from the output and check its status. It moves from starting to running within a few seconds.
Run a command
Anything after -- runs inside the machine. The CLI exits with the command's exit code.
Leave out the command to open an interactive shell.
Move a file in and out
Delete the machine
Deleting a machine also deletes its root disk. Attached disks are kept.
With the SDK
The same flow in code. Machine operations return the machine object; shell() and files() open a live connection to the machine.
Note
In Python, resource calls such as create and get are synchronous. The live helpers shell(), files(), and connect() are async.
Next steps
- Configure a machine: size, environment variables, and startup commands
- Lifecycle and hibernation: pause and hibernate idle machines automatically
- Connect with the SDK: stream output, run background processes, and call ports