Skip to main content

CLI Reference

The Crusoe Cloud Command Line Interface is a tool that provides a consistent interface for interacting with all parts of Crusoe Cloud.

Install the CLI

You can install the Crusoe CLI by first visiting Install and Configure the CLI.

Usage

Usage: crusoe [command] [flags]

Command

The Crusoe CLI has the following command for various resources in Crusoe Cloud:

compute Subcommand for managing Crusoe Cloud compute resources

keys Subcommand for managing SSH Keys

locations Subcommand for viewing Crusoe locations

networking Subcommand for managing Crusoe Cloud networking resources

projects Subcommand for managing Crusoe Cloud Project resources

storage Subcommand for managing Crusoe Cloud storage resources

whoami Display details about current user

At any point, use crusoe [command] --help for more information about a command.

Compute

Subcommand for managing Crusoe Cloud compute resources

images Subcommand for viewing Crusoe Cloud VM images

crusoe compute images COMMAND [flags]

Commands:
list List all VM images

Flags:
-h, --help Help for images
  • list List all available VM Images
crusoe compute vms list [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for list
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.

vms Subcommand for managing Crusoe Cloud VM resources

crusoe compute vms COMMAND [flags]

Commands:
attach-disks Attach disks to a VM
create Create a new VM
delete Delete a VM
detach-disks Detach disks from a VM
get Get details about a VM
list List all VMs
reset Reset a VM
serial-console Connect to serial console on a VM
ssh SSH into a VM
start Start a VM
stop Stop a VM
types List available VM types
update Update a VM.

Flags:
-h, --help Help for vms
  • attach-disks Attach disks to a VM
crusoe compute vms attach-disks

Flags:
--disk strings [required] Disk attachment, with name or ID and mode. Specified as name=<name>,mode=<mode> or id=<id>,mode=<mode>. Either read-only or read-write for mode.
-f, --format string Output format. (default "pretty")
-h, --help help for attach-disks
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
-y, --yes Autoconfirm selection

  • create Create a new VM
crusoe compute vms create --name <name> --type <type> --location <location> [flags]

Flags:
--count int Number of VMs to create. If multiple specified, VMs will be created atomically with the naming convention name-<number>. (default 1)
--disk strings Disk attachment, with name or ID and mode. Specified as name=<name>,mode=<mode> or id=<id>,mode=<mode>. Either read-only or read-write for mode.
-f, --format string Output format. (default "pretty")
-h, --help Help for create
--ib-partition-id string IB Partition if deploying with Infiniband.
--image string VM Image. List available options with "crusoe compute images list".
--keyfile string Path to ssh public key file. Optional if set in CRUSOE_SSH_PUBLIC_KEY_FILE env variable
or the config file. (default "~/.ssh/id_ed25519.pub")
--location string [Required] Location. List available locations with "crusoe locations list".
--name string [Required] VM name. Alphanumeric characters, underscores and dashes are allowed.
--network-interface strings Network interface config. Specify --network-interface vpc-subnet-id=<ID>"
--project-id string Project ID. Optional if Project Name is set in CRUSOE_DEFAULT_PROJECT env variable
or the config file.
--project-name string Project Name. Optional if set in CRUSOE_DEFAULT_PROJECT env variable
or the config file.
--reservation-id string Reservation ID to attribute to the VM.
--reservation-strategy string Reservation strategy. Defaults to lowest-cost unless otherwise specified. Allowed values are: lowest-cost, on-demand.
--shutdown-script string Path to shutdown script file. This must be a bash script smaller than 64 KB.
--startup-script string Path to startup script file. This must be a bash script smaller than 64 KB.
--type string [Required] VM type. List available types with "crusoe compute vms types".
--virtualization-features stringToString Virtualization features. Example: --virtualization-features nested_virtualization=true (default [])
--vpc-subnet-id string VPC Subnet ID. Subnet the VM will be created in.

  • delete Delete a VM
crusoe compute vms delete <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for delete
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
  • detach-disks Detach disks from a VM
crusoe compute vms detach-disks <name> [flags]

Flags:
--disks strings [required] Disk names (comma sperated). Alphanumeric characters, underscores and dashes are allowed.
-f, --format string Output format. (default "pretty")
-h, --help help for detach-disks
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
-y, --yes Autoconfirm selection
  • get Get details about a VM
crusoe compute vms get <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for get
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
  • list List all VMs
crusoe compute vms list [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for list
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.

  • reset Reset a VM
crusoe compute vms reset <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for reset
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
  • serial-console Connect to serial console on a VM
crusoe compute vms serial-console --name <name> [flags]

Flags:
-h, --help help for serial-console
--name string [required] VM name. Alphanumeric characters, underscores and dashes are allowed.
--port-num int port number between 1-4 (default 1)
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.

More information on setting up serial-console can be found at Serial Console access

  • ssh SSH into a VM
crusoe compute vms ssh <name> [flags]

Flags:
-h, --help Help for ssh
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
--ssh-keyfile string [required] Path to ssh private key file.
  • start Start a VM
crusoe compute vms start <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for start
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
  • stop Stop a VM
crusoe compute vms stop <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help help for stop
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
-y, --yes Autoconfirm selection
  • types List available VM types
crusoe compute vms types [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help Help for types
--project-id string Project ID. Either this or project name must be specified.
--project-name string Project Name. Either this or project ID must be specified.
  • update Update a VM.
crusoe compute vms update <name> [flags]

Flags:
-f, --format string Output format. (default "pretty")
-h, --help help for update
--ib-partition-id string IB Partition if deploying with Infiniband.
--project-id string Project ID. Optional if Project Name is set in CRUSOE_DEFAULT_PROJECT env variable
or the config file.
--project-name string Project Name. Optional if set in CRUSOE_DEFAULT_PROJECT env variable
or the config file.
--type string VM type. List available types with "crusoe compute vms types".
-y, --yes Autoconfirm selection

format Examples

You can format the output of Crusoe CLI commands in either "pretty" or "json" format.

An example of using the -f, --format "json" flag for the command: crusoe compute vms list -f "json" will return the following JSON response:

crusoe compute vms list -f "json"

[
{
"commitment_end": "",
"commitment_period": 0,
"created_at": "2024-02-27T19:17:58Z",
"disks": [
{
"attachment_type": "os",
"block_size": 0,
"created_at": "2024-02-27T19:17:59Z",
"id": "12345678-50e9-45a9-ab1c-123456748912",
"location": "mtkn-cdp-prod",
"mode": "read-write",
"name": "OS-disk-a1234567-1234-1234-1234-ab1234567891",
"serial_number": "ABC123456789DEF,
"size": "128GiB",
"type": "persistent-ssd",
"updated_at": "2024-02-27T19:18:00Z"
}
],
"host_channel_adapters": [],
"id": "12345678-50e9-45a9-ab1c-123456748912",
"location": "us-northcentral1-a",
"name": "my-vm",
"network_interfaces": [
{
"id": "12345678-50e9-45a9-ab1c-123456748912",
"interface_type": "Ethernet",
"ips": [
{
"private_ipv4": {
"address": "172.27.13.246"
},
"public_ipv4": {
"address": "204.52.21.213",
"id": "12345678-50e9-45a9-ab1c-123456748912",
"type": "dynamic"
}
}
],
"mac_address": "ae:4b:46:4e:61:13",
"name": "default-network-interface",
"network": "5533850c-d1bb-4e19-9bdc-1fc38392f18d",
"subnet": "9a6fbcaa-4a1d-4a6f-aab4-b542b73e536d"
}
],
"project_id": "a1234567-1234-5678-9123-b123456789",
"ssh_destination": ":0",
"state": "STATE_RUNNING",
"type": "a100.4x",
"updated_at": "2024-02-27T19:18:46Z"
}
...
]

You can then | jq to slice data to get specific information.

Get the name of a VM

crusoe compute vms list -f "json" | jq '.[].name'

Outputs:

"test-vm"

Get information on attached disks

crusoe compute vms list -f "json" | jq '.[].disks'

Outputs:

[
{
"attachment_type": "os",
"block_size": 0,
"created_at": "2024-02-24T18:15:12Z",
"id": "738838cf-4f69-4ff4-91d8-68db83ea7d52",
"location": "mtkn-cdp-prod",
"mode": "read-write",
"name": "OS-disk-e25575f1-1501-4c8c-b390-6bdef622b816",
"serial_number": "671A56B1350595F193E",
"size": "128GiB",
"type": "persistent-ssd",
"updated_at": "2024-02-24T18:15:13Z"
}
]

Get information on network interfaces

crusoe compute vms list -f "json" | jq '.[].network_interfaces'

Outputs:

[
{
"id": "a0b30e14-5d60-4c04-86eb-33e9c8e39237",
"interface_type": "Ethernet",
"ips": [
{
"private_ipv4": {
"address": "172.27.13.246"
},
"public_ipv4": {
"address": "204.52.21.213",
"id": "648a3bbd-9c88-4f09-858f-1a346ffc438f",
"type": "dynamic"
}
}
],
"mac_address": "ae:4b:46:4e:61:13",
"name": "default-network-interface",
"network": "5533850c-d1bb-4e19-9bdc-1fc38392f18d",
"subnet": "9a6fbcaa-4a1d-4a6f-aab4-b542b73e536d"
}
]

The above are just a few examples. There are many more values available you can grab with jq that are specific to your use case.