Skip to main content

CLI tool

Cudo Compute has a CLI tool called cudoctl to manage all of your resources within the platform.

Note

You will need to create an API key from the web UI before you can use cudoctl.

Getting Started

Run cudoctl init and follow the steps.

$ cudoctl init
✔ api key: my-api-key
✔ project: my-project
✔ billing account: my-billing-account
✔ context: default
config file saved ~/.config/cudo/cudo.yml

A config file will be maintained in $HOME/.config/cudo/cudo.yml

configVersion: v0
keys:
- key: xxxyyyzzz
name: my-first-api-key
- key: aaabbbccc
name: my-second-api-key
contexts:
- name: cudo-demo
key: my-first-api-key
billing-account: xxxxxxxxx
project: my-project
- name: cudo-demo-2
key: my-second-api-key
billing-account: xxxxxxxxx
project: my-other-project
current-context: cudo-demo

The file can be edited manually, and new contexts can be added using cudoctl init. Multiple contexts can be setup which are used like profiles when cudoctl runs. One context is selected at a time as the current context.

➡️ Show help at any level by using -h e.g cudoctl -h

Global Options

Global options are used to set top level options that affect the rest of the execution of cudoctl . See cudoctl -h for more details.

Examples

# choose a config file
$ cudoctl --config /etc/config/cudo.yaml <group> [command]

# set context with an environment variable
$ CUDOCTL_CONTEXT=local cudoctl <group> [command]

# output in json
$ cudoctl --json <group> [command]

Config

Show and set the current config context. See cudoctl config -h for more details.

Examples

$ cudoctl config current
local

$ cudoctl config use cudo-demo-2

$ cudoctl config current
cudo-demo-2

$ cudoctl config show
name: cudo-demo-2
key: my-second-api-key
billing-account: xxxxxxxxx
project: my-other-project

SSH Keys

See cudoctl ssh-keys -h for more details.

Initialise SSH key access to virtual machines

Using initialise is an interactive way to add an SSH key to your account.

You can choose a locally found key or chose another key.

$ cudoctl ssh-keys init
Use the arrow keys to navigate: ↓ ↑
? Upload an SSH key:
▸ ssh-rsa SHA256:asd123 [email protected]
other key
Added ssh-rsa key to your account

To use another key, you can enter a path to a key or paste a key directly into the terminal.

$ cudoctl ssh-keys init
✔ other key
Use the arrow keys to navigate: ↓ ↑ → ←
? Upload an SSH key:
▸ enter key file path
enter key

Enter a key from a path

$ cudoctl ssh-keys init
✔ other key
✔ enter key file path
file path: ~/.ssh/id_rsa.pub
Added ssh-rsa key to your account

or paste a key directly into the terminal.

$ cudoctl ssh-keys init
✔ other key
✔ enter key
✔ key: SHA256:asd123 [email protected]
Added ssh-rsa key to your account

Add an SSH key

$ cudoctl ssh-keys add -file path/to/key.pub

List SSH keys

$ cudoctl ssh-keys add list
pageNumber: 1
pageSize: 10
sshKeys:
- comment: [email protected]
createTime: "2022-11-04T12:08:16.822678Z"
fingerprint: SHA256:asd123
id: r8th1g7d1vc2
publicKey: ssh-rsa asd123... [email protected]
type: ssh-rsa
...
totalCount: 1

Delete an SSH key

$ cudoctl ssh-keys delete r8th1g7d1vc2

List available OS images

List the available OS images. OS images define the initial state of the boot volume of virtual machines.

$ cudoctl search images
- description: Ubuntu 20.04 LTS (focal)
id: ubuntu-2004
name: Ubuntu 20.04
size: 2.4 GB
...

Find available virtual machines

Search for available compute resources. See cudoctl search -h to see filtering options.

$ cudoctl search
- machineType: sgwnzk4cp4bf
cpu: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz
memoryGb: 8
pricePerHour: 0.018412698
region: europe-west
storageGb: 26
vcpus: 4
...

Find available virtual machines with minimum vCPUs

$ cudoctl search -cores 4
- machineType: sgwnzk4cp4bf
cpu: Intel(R) Xeon(R) CPU E5-2690 v3 @ 2.60GHz
memoryGb: 8
pricePerHour: 0.02
region: europe-west
storageGb: 26
vcpus: 4
...

Find available GPU enabled virtual machines

$ cudoctl search -gpus 1
- machineType: riycyl5fzkm9
cpu: Intel(R) Xeon(R) CPU E5-2680 v4 @ 2.40GHz
gpuVendor: nvidia
gpuClass: GTX 1080
gpuMemoryGb: 11
gpuCount: 1
memoryGb: 188
pricePerHour: 10
region: europe-west
storageGb: 145
vcpus: 56
...

Projects

A project is a container for cloud resources. You need to create a project before you can create virtual machines. See cudoctl projects -h for more details.

Create a project

$ cudoctl projects create example-project
billingAccountId: yyfh32y6d9v2
createBy: user-account-id
id: example-project

List projects

$ cudoctl projects
projects:
- billingAccountId: yyfh32y6d9v2
createBy: user-account-id
id: example-project
...

Delete a project

$ cudoctl projects delete example-project

Virtual machines

A virtual machine is a billable computing resource. You need to create a project before you can create virtual machines. See cudoctl virtual-machines -h for more details.

Get a virtual machine

Get the details a virtual machine.

$ cudoctl vm get ***VIRTUAL_MACHINE_NAME***

Create a virtual machine

Create virtual machines using the compute resource found.

$ cudoctl vm create
--image=***IMAGE_NAME***
--compute=***COMPUTE_ID***
[***VIRTUAL_MACHINE_NAME***]

Reset a virtual machine

Perform a hard reset on virtual machines.

$ cudoctl vm reset ***VIRTUAL_MACHINE_NAME***

Start a virtual machine

Start stopped virtual machines.

$ cudoctl vm start ***VIRTUAL_MACHINE_NAME***

Stop a virtual machine

Stop running virtual machines.

$ cudoctl vm stop ***VIRTUAL_MACHINE_NAME***

Delete a virtual machine

Delete virtual machines.

$ cudoctl vm delete ***VIRTUAL_MACHINE_NAME***

Help

Get help inside the CLI tool

$ cudoctl -h
usage: "cudoctl [global option...] <group> [group option...] [<cmd> [cmd option...]] [<sub cmd> [sub cmd option...]]"

Get started with "cudoctl init" to initialise a config interactively. Use "cudoctl config use <name>" to switch between config contexts.

basic groups:
config show and set the config context
ssh-keys manage ssh keys used to access VMs
search search for available compute resources
virtual-machines manage VM resources in a project

other groups:
api-keys manage long lived credentials that allow access to cudo
auth manage permissions for projects, data centers and billing accounts you own
billing-accounts billing accounts group spend and earnings for projects and data centers
data-centers host resources are grouped into data centers for management
projects compute resources are grouped into projects for management

global options:
-config string
the path to a config file to use (env: CUDOCTL_CONFIG) (default "/Users/chris/.config/cudo/cudo.yml")
-context string
the name of a config context to use (env: CUDOCTL_CONTEXT)
-json
json output (env: CUDOCTL_JSON)
-session string
temporary authentication session token (env: CUDOCTL_SESSION)
-verbose int
output verbosity 0-2
-version
show the version of cudoctl

Use "cudoctl [group [command]] -h" for more information about a given group or command.
parsing flag: help requested