Using Triton CLI to operate cloud instances

Requirements to use Triton CLI

  • triton CLI installed
  • Data center (DC) you'd like to connect to
  • Account name
  • SSH key pair

Installing Triton CLI

Option 1: npm

Install Node.js + npm

Then:

npm install --global triton json

This will globally install both the triton CLI and the json tool on your system, the last one being an additional useful helper when working with the JSON-based CloudAPI.

Option 2: tritonshell (nix)

Please follow the instructions to install tritonshell. After you've successfully installed it, the following command should return its help text:

ttp

Profile setup

triton CLI uses profiles to store access information. Usually you need to create one profile per DC you're operating in, e.g. lev-1 and cgn-1. If you manage multiple accounts in multiple DCs, you'll need to create one profile per account per DC. Profiles make it easy to connect to different data centers, or connect to the same data center as different users.

Prepare the following information, required for profile creation:

  • Profile name, free to choose (e.g. lev-1-testuser)
  • Data center API URL
  • Account login name
  • SSH key fingerprint (choosable from option menu)

If you have never worked with an SSH key pair before, please start by generating it:

ssh-keygen

Now, let's create our first profile:

triton profile create

Follow the instructions printed to your terminal.

Greenbaum data centers

Data center (DC)CloudAPI URL
lev-1https://lev-1.api.greenbaum.cloud
cgn-1https://cgn-1.api.greenbaum.cloud

Triton CLI quick start

Basic info about your current profile:

triton info

List existing instances (started & stopped):

triton instances

Create new instance:

triton instance create --name=debian-test --tag="triton.cns.services=debian" debian-11 small

Information about the new instance:

triton instance get debian-test

The instance's state should be "running" or still "provisioning". Please take note of "memory" and "disk" (in MiB).

Connect to the created instance (once its state is "running":

triton ssh debian-test

Once inside the instance, run:

free -h && df -h

This shows the available memory and disk from inside the instance.

Open a new terminal, then: live resize the instance with zero downtime:

triton instance resize debian-test medium

Switch back to the first terminal, after 5-10 seconds, run again:

free -h && df -h

You should see the change of available memory from 1024MiB to 2048MiB. The disk size has increased from 25GiB to 30GiB.

List networks:

triton networks

Remove instances:

triton instance rm debian-test