The VM CLI accepts either a VM ID or your team-local slug wherever it asks for
<vmId>. See Freestyle CLI for installation and authentication.
Create, List, And Inspect
freestyle vm create --slug development --display-name "Development VM"
freestyle vm list
freestyle vm get development
Create from a snapshot, attach to a VPC, or open a shell immediately:
freestyle vm create --snapshot-id freestyle/ubuntu --slug builder
freestyle vm create --vpc private --ipv4 10.40.0.10
freestyle vm create --slug scratch --ssh
Use repeatable --metadata key=value flags on create or update. Filter lists
with --state, --slug, --snapshot-id, or comma-separated
--metadata key:value pairs.
Run Commands
Put the guest command after -- so its flags are passed through unchanged:
freestyle vm exec development -- uname -a
freestyle vm exec development --timeout-ms 60000 \
--env NODE_ENV=production -- npm test -- --runInBand
vm exec streams stdout and stderr, then exits with the guest command’s exit
status. Allocate an interactive PTY with -it:
freestyle vm exec -it development -- bash
freestyle vm exec -it development --linux-user developer -- python3
For a login shell, use freestyle vm ssh development. Despite the name, the
CLI opens the same Freestyle PTY API directly and does not need a local SSH
key.
Update And Lifecycle
freestyle vm update development --display-name "Build worker" \
--idle-timeout-seconds 600 --metadata environment=staging
freestyle vm resize development --cpu 8 --memory 16384 --storage 81920
freestyle vm pause development
freestyle vm start development
freestyle vm delete development
Memory and storage are measured in MiB. Resizing is grow-only.
Snapshots
freestyle vm snapshot create development --slug configured-worker
freestyle vm snapshot list --source-vm-id development
freestyle vm snapshot get configured-worker
freestyle vm snapshot update configured-worker --display-name "Configured worker"
freestyle vm snapshot delete configured-worker
snapshot create returns once the snapshot is materialized and ready to boot
from.
Files And SCP
freestyle vm fs write development /root/app.tar ./app.tar
freestyle vm fs read development /var/log/app.log --out ./app.log
freestyle vm fs ls development /root
freestyle vm fs mkdir development /root/output
freestyle vm fs stat development /root/app.tar
freestyle vm fs rm development /root/output
freestyle vm scp ./app.tar development:/root/app.tar
freestyle vm scp development:/var/log/app.log ./app.log
scp and the fs commands operate as root inside the VM. To place a file
under another user, copy it and chown it with vm exec.
The filesystem commands stream large files and use the SDK’s resumable upload transport automatically.
JSON Output
--output is a global option. Use it instead of the removed --json flag:
freestyle --output json vm list | jq '.vms[] | {id, state}'