The Exoscale command-line interface
exo is the official command-line tool to access Exoscale’s services. It allows you to manage your infrastructure from an user friendly command-line with the benefits of a scriptable interface.
Installation
To get started download the archive corresponding to your operating system from the latest release on GitHub.
GNU/Linux
Debian / Ubuntu
- Download
cli_$VERSION_linux_amd64.deb
- Run
$ sudo dpkg -i cli_$VERSION_linux_amd64.deb
RedHat / CentOS
- Download
cli_$VERSION_linux_amd64.rpm
- Run
sudo rpm -i cli_$VERSION_linux_amd64.rpm
Other distributions
- Download
cli_$VERSION_linux_amd64.tar.gz
- Expand it
- Put the
exo
binary into your$PATH
, e.g./usr/local/bin/
Docker
You can run the cli as a Docker container with the following command
docker run -it exoscale/cli <command argument>
Note
The docker builds are for amd64 architecture only. For arm or arm64 use the tar.gz release
Apple macOS
Install with Homebrew:
brew tap exoscale/tap
brew install exoscale-cli
Or alternatively:
- Download and open
cli_$VERSION_darwin_amd64.tar.gz
- Copy the
exo
executable in a directory inside your$PATH
Microsoft Windows
The binary file works for both the traditional Command Prompt as well as the more modern PowerShell.
- Download
cli_%VERSION%_windows_amd64.zip
-
Open the command-line shell (
cmd.exe
) and type the following commandsmkdir C:\exoscale setx path "%path%;C:\exoscale;"
-
Put all files from zip archive into
C:\exoscale\
Configuration
A configuration file holding your credentials is required. You can generate one via a guided prompt. The following parameters are requested:
API Key
Secret Key
If you don’t already have a key and the corresponding secret, you can generate one using the Exoscale Console. To do so, log in and navigate to:
Configuration
The CLI will guide you in the initial configuration.
$ exo config
Once saved, you can review your current configuration later by running the exo config show
command.
Commands overview
You are now ready to use the CLI. Start by calling the raw exo --help
command. This will give you a list of the possible commands and options.
Create a Compute instance
The exo compute instance
command allows you to do basic CRUD operations on Compute instances.
Run exo compute instance create
to deploy an instance:
$ exo compute instance create example
✔ Creating instance "example"... 18s
┼──────────────────────┼──────────────────────────────────────┼
│ COMPUTE INSTANCE │ │
┼──────────────────────┼──────────────────────────────────────┼
│ ID │ 7b014127-e635-4d14-b8c4-090549891583 │
│ Name │ example │
│ Creation Date │ 2021-09-15 15:45:28 +0000 UTC │
│ Instance Type │ standard.medium │
│ Template │ Linux Ubuntu 20.04 LTS 64-bit │
│ Zone │ ch-gva-2 │
│ Anti-Affinity Groups │ n/a │
│ Security Groups │ default │
│ Private Networks │ n/a │
│ Elastic IPs │ n/a │
│ IP Address │ 85.217.161.93 │
│ IPv6 Address │ - │
│ SSH Key │ - │
│ Disk Size │ 50 GiB │
│ State │ running │
│ Labels │ n/a │
┼──────────────────────┼──────────────────────────────────────┼
The command automatially create an ssh key specifically for this instance. If you wished to use an SSH key of yours, you can refer to it by name via the --ssh-key <keyname>
option.
Create a firewall rule to allow SSH connection
By default, security groups without any rule specified block all incoming connections.
To reach your instance via SSH, you have to explicitly allow ingress on port 22.
The exo compute security-group rule add
command lets you do so:
$ exo compute security-group rule add default --network 0.0.0.0/0 --port 22
✔ Adding rule to Security Group "default"... 3s
┼──────────────────┼────────────────────────────────────────────────────────────────────┼
│ SECURITY GROUP │ │
┼──────────────────┼────────────────────────────────────────────────────────────────────┼
│ ID │ 9eb186db-cf1f-4f8a-8218-03d2a0150f11 │
│ Name │ default │
│ Description │ │
│ Ingress Rules │ │
│ │ dfc6d3a6-a15f-430f-b999-82a80ffc3aac TCP 0.0.0.0/0 22 │
│ │ │
│ Egress Rules │ - │
│ External Sources │ - │
┼──────────────────┼────────────────────────────────────────────────────────────────────┼
Connect to a Compute instance via SSH
The exo compute instance ssh
command allows you to directly log into an instance using an SSH connection.
$ exo compute instance ssh example
Host key fingerprint is SHA256:nmAfu17qHLkJkEpOy2qXWaV5nSMq0yzKD6j0giZIghk
Welcome to Ubuntu 19.04 LTS (GNU/Linux 4.15.0-20-generic x86_64)
ubuntu@example:~$
Cleaning up
Removing an instance is as simple as creating one. Be cautious as there are no ways to undo a deletion.
$ exo compute instance delete example
[+] Are you sure you want to delete instance "example"? [yN]: y
✔ Deleting instance "example"... 6s
Alternative output formats
By default, commands outputting information as a result of an operation
format the content in a table, a format convenient for human consumption. In case
you’re use the exo
CLI in scripts, you might find alternative output formats JSON or
templated text to be more
suited for non-interactive uses:
# JSON
$ exo compute instance show example -O json | jq -r .ip_address
85.217.161.93
# Text templating
$ exo compute instance show example -O text --output-template '{{.ID}}@{{.Zone}}'
7b014127-e635-4d14-b8c4-090549891583@ch-gva-2
More information on this topic can be found by running the exo help output
command.
The complete documentation
There is a built-in help to explore all the possibilities.
$ exo --help