Installing Triton CLI on Windows

April 17, 2018 - by Carol Cobine

This tutorial explains how to prepare Windows to install the triton command line tools. In order to install triton, you must first generate an SSH key pair and then upload the public key to Triton. To ensure a successful deployment on Windows, we perform these and other steps in a different order than you may be used to if you've used triton on macOS.

Before you begin

Before you begin, ensure that you have a Triton Compute Service account with valid billing information. If you are new to Triton, sign up for a free trial account.

You may also want to install a plain text editor. Technically, a text editor isn’t required to install Triton CLI, but it’s really handy way to take advantage of native Windows functionality. Unlike Microsoft Word and other word processors, plain text editors consist exclusively of character representation. There is no metadata encoded that may break your applications. It is important to understand the difference between these tools.

If you are comfortable with command line text editors such as nano or Vi, you may skip this step. However, Notepad++ is an easy-to-use, free text application. You can download and install Notepad++ from

Step 1: Downloading and installing Git Bash

Windows doesn't have a default SSH client. While there are many applications that offer SSH key generation, Git Bash is the most reliable way to generate SSH keys that are compatible with Triton. Git Bash, available with the Git installation package, provides a way to access and manage Triton containers at the command line. We recommend using the Git Bash client to generate SSH keys.

To install Git Bash:

  1. Download and initiate the Git installation package.
  2. When prompted, accept the default components by clicking Next.
  3. Choose a default text editor. I chose Notepad++.
  4. Select to Use Git from the Windows Command Prompt and click Next.
  5. Select to Use OpenSSL library and click Next.
  6. Select to Checkout Windows-style, commit Unix-style line endings and click Next.
  7. Select to Use MinTTY (The default terminal of mYSYS2) and click Next.
  8. Accept the default extra options configuration by clicking Install.

When the installation completes, you may need to restart Windows.

Step 2: Generating SSH Keys

Windows assumes that the Windows account you are using has administrative privileges. Given this, you create the SSH directory at the root of your profile, in your home directory C:\Users\ccobine, and then generate the SSH key pair.

To run Git Bash as an Administrator, launch the application from the Windows command prompt:

  1. In Windows, press Start+R to launch the Run dialog.
  2. Type C:\Program Files\Git\bin\bash.exe and press Enter.
  3. At the Git Bash command line, change into your root directory and run ssh-keygen.

Note: Triton authenticates using the key fingerprint so adding a password is optional. When prompted for a password, you can choose to leave this field blank. If you enter a password, you will need to add it to ssh-agent. You can learn more about this from our ssh-agent documentation.

Here is an example of the SSH generation commands and the resulting output:

$ mkdir .ssh
$ cd C:\Users\ccobine\.ssh
$ ssh-keygen.exe

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/ccobine/.ssh/id_rsa): /c/Users/ccobine/.ssh/
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /c/Users/ccobine/.ssh/
Your public key has been saved in /c/Users/ccobine/.ssh/
The key fingerprint is:
SHA256:jieniOB720935n0nowo04n002HqEIOnTIOnevHzaI5nak ccobine@periwinkle
The key's randomart image is:

 +---[RSA 2048]----+
 |*= =+..           |
 |O*=.B            |
 |+*o* +           |
 |o +o.  .         |
 | ooo  + S        |
 |* oo      |
 |  .+o+*ooo .      |
 |   .=+..         |
 |   Eo            |

$ dir .ssh

Step 3: Uploading the public SSH key to Triton

As stated above, Triton authenticates using the key fingerprint. Once you create the key pair, you must upload the public key to Triton to associate it with your account.

To upload the public SSH key to your Triton account:

  1. Copy the contents of the public SSH key file.
  2. In the Triton Compute Service portal, select Account to open the Account Summary page.
    Location of Triton Account Summary page
  3. From the SSH section, select Import Public Key.
  4. Enter a Key Name. Although naming a key is optional, labels are a best practice for managing multiple SSH keys.
  5. In the Public Key box, paste the public key.
  6. Click Add.

When Triton finishes the adding or uploading process, the public SSH key appears in the list of SSH keys. Now, you are ready to install Node.js.

Step 4: Downloading and Installing Node.js

To install Triton CLI or other CloudAPI tools, you must first install Node.js.

To install Node.js:

  1. Download and initiate the latest version of the Node.js installer appropriate for Windows.
  2. When the installation completes, reboot your machine.
  3. Launch the Node.js command prompt application as Administrator.

Once Node.js is installed, you can install triton using Node Package Manager (npm).

Step 5: Installing Triton CLI

From the Git-Bash or Windows command line, you can issue the npm install command with a global flag that installs the triton, smartdc, docker, and other modules so that each is accessible to all users.

npm install -g triton
npm install –g smartdc
npm install –g docker

Step 6: Configuring environment variables

Environment variables are a way to store configurable values across your entire system. On Windows, you must configure environment variables to define the path information between Windows applications and to populate profile information referenced by Triton.

Adding environment variables to bash profile

For Triton, you define environment variables in the bash profile, typically named .bashrc. The bash profile is located in your home directory. If your home directory doesn't contain a bash profile, you can create a file named .bashrc.

  1. From the Git Bash terminal, edit your bash profile by adding the following variable definitions. Be sure to modify this example code to your Triton username and SSH key if not
export TRITON_PROFILE="env"
export TRITON_URL=""
export TRITON_KEY_ID="$(ssh-keygen -l -f $HOME/.ssh/ | awk '{print $2}')"

After January 2018, environment variables are defined with TRITON_* prefixes. In versions of triton prior to January 2018, environment variables were defined with the SDC_* prefixes. If you've installed smartdc, you must also define SDC_*` environment variables in addition to TRITON_* environment variables.

If you define both types of variables, your bash profile may look similar to:

export TRITON_PROFILE="env"
export TRITON_URL=""
export TRITON_ACCOUNT="ccobine"
export TRITON_KEY_ID="$(ssh-keygen -l -f $HOME/.ssh/ | awk '{print $2}')"
export SDC_URL=""
export SDC_ACCOUNT="ccobine"
unset SDC_USER
export SDC_KEY_ID="$(ssh-keygen -l -f $HOME/.ssh/ | awk '{print $2}')"

Adding system variables in Windows

Defining environment variables in Windows ensures that the system properly sets the paths to the variables across applications for the current user account.

To configure system variables:

  1. Open an Explorer window.
  2. In the navigation pane, right-click This PC and select Properties.
  3. Select Advanced system settings.
  4. Select Environment Variables.

For triton CLI, define variables for the User (current user) only. Creating global system variables can cause problems with ssh key validation.

  1. Under User Variables, click New and create the following variables:
    • TRITON_ACCOUNT: the username of your Triton account or the name of your local SDC account.
    • TRITON_URL: The API endpoint for the datacenter to access. For this tutorial, use as the endpoint.
    • TRITON_KEY_ID: The fingerprint of your SSH public/private key pair
  2. Close the command line app and re-open to setup up the paths. In most cases, a reboot isn't required.

Step 7: Configuring Triton profiles

Triton CLI stores access information in profiles. Profiles contain the data center CloudAPI endpoint, your account login, and SSH key fingerprint. Profiles make it easy to connect to different data centers, or connect to the same data center as different users.

The triton profile create command prompts you to answer a series of questions to configure your profile. The following example shows the steps for the Triton user ccobine:

$ triton profile create

A profile name. A short string to identify an endpoint to the `triton` CLI.
name: us-sw-1

The CloudAPI endpoint URL.

Your account login name.
account: ccobine

The fingerprint of the SSH key you have registered for your account. You may enter a local path to a public or private key to have the fingerprint calculated for you.
keyId: ~/.ssh/<ssh key name>.id_rsa
Fingerprint: 2e:c9:f9:89:ec:78:04:5d:ff:fd:74:88:f3:a5:18:a5

Saved profile "us-sw-1"

To test the initial profile configuration, run triton info:

$ triton info

login: ccobine
name: Carol Cobine
totalDisk: 65.8 GiB
totalMemory: 2.0 GiB
instances: 2
running: 2

The triton info output displays information about the profile we have just configured. Notice that you will see information about any instances you may have running. If you haven't created an instance, we'll show you how to do that after we set up a few more profiles.

Configuring multiple profiles

Next, let's create a profile for each data center. For this tutorial, we run triton commands to make a copy of a us-sw-1 profile for each of the data center urls. You can copy and paste the snippet below to create the new profiles:

triton datacenters | egrep -v NAME | while read -r i; do name=$(echo $i | awk {'print $1'}); url=$(echo $i | awk {'print $2'}); triton profile get -j env | sed -e "s/env/$name/" -e "s#http[^\"]*#$url#" | triton profile create -f - -y; done

Run triton profiles again to check to see if the command worked. We should have a new profile for each data center listed in triton datacenters:

$ triton profiles
env              ccobine         -
eu-ams-1         ccobine         -
us-east-1        ccobine         -
us-east-2        ccobine         -
us-east-3        ccobine         -
us-sw-1    *     ccobine         -
us-west-1        ccobine         -

Joyent's Triton CLI documentation contains more information on configuring profiles.

Step 8: Creating an instance

Now that you have triton tools available and have basic profile and environment variables configured, you can begin provisioning instances. You can read more about creating instances in the Triton CLI documentation.

In this example, triton instance create creates an Ubuntu instance named server-1:

$ triton instance create -w --name=server-1 ubuntu-14.04 g4-highcpu-1G
Creating instance server-1 (e9314cd2-e727-4622-ad5b-e6a6cac047d4, ubuntu-14.04@20160114.5, g4-highcpu-1G)
Created instance server-1 (e9314cd2-e727-4622-ad5b-e6a6cac047d4) in 22s

Step 9: Connecting to the new instance

Let's try connecting to your new instance. You can also try connecting to an existing instance if you have previously created one using Triton CLI or on the portal.

In the Git Bash client, run the command triton ssh <servername>, where <servername> is the name of your instance.

triton ssh server-1

You are connected!

Troubleshooting an SSH connection to an instance

If the resulting output displays the message "key already exists for that server" error, you aren't celebrating a successful connection to your instance. The error message means that you've connected to the instance in the past and need to update the key for the instance.

To address this issue, you must obtain the IP address for the instance, try connecting directly to that IP address, and then run ssh-keygen to update the key connected to the instance.

  1. Obtain the IP address of the instance by issuing the command:
    $ triton ip server-1
  2. Type the following SSH command to try reconnecting:
    ssh root@ -l root
  3. If the connection attempt is unsuccessful, update the key for the instance.
    ssh-keygen -R
  4. SSH into the instance once again.
    ssh root@ -l root

You should see the instance spinning up.

Wrapping up

You may have noticed that we often reference our existing docs, such as the Triton CLI documentation, asking you to read them to explore more. Remember that setting up Triton in Windows simply requires that you perform the same steps detailed in our getting started documentation with just a few changes.

You can continue testing CloudAPI by running additional triton commands. Finally, you can learn more about methods and resources in Joyent's reference documentation