Working with CloudAPI

Modified: 05 Jan 2015 18:06 UTC

The Joyent Cloud API is a RESTful API for programmatically interfacing with the Joyent Public Cloud. Many of the tasks that you can perform through the portal are also possible through CloudAPI including:

In this page, you will learn how to install the Cloud API command line tools. You can learn more about CloudAPI at

The CloudAPI tools require Node.js. You can find the latest version of Node.js at

Once Node.js is installed, install the CloudAPI tools. This command installs the CloudAPI tools globally.

$ npm -g install smartdc
. . .
smartdc@7.2.0 /usr/local/lib/node_modules/smartdc
├── assert-plus@0.1.2
├── clone@0.1.6
├── lru-cache@2.2.0
├── nopt@2.0.0 (abbrev@1.0.4)
├── smartdc-auth@1.0.1 (once@1.1.1, clone@0.1.5, ssh-agent@0.2.1, vasync@1.3.3)
├── bunyan@0.21.1 (mv@0.0.5, dtrace-provider@0.2.8)
└── restify@2.4.1 (once@1.1.1, deep-equal@0.0.0, keep-alive-agent@0.0.1, semver@1.1.4, lru-cache@2.3.0, node-uuid@1.4.0, mime@1.2.9, negotiator@0.2.5, spdy@1.7.1, backoff@2.1.0, formidable@1.0.13, qs@0.5.5, verror@1.3.6, http-signature@0.9.11, dtrace-provider@0.2.8)

If you get an EACCESS error, you may need to use sudo to install globally:

$ sudo npm -g install smartdc

Next, set up your environment variables. You can set these in your .bashrc or .bash_profile file.

export SDC_URL=<URL of a Joyent Cloud datacenter> (see below)
export SDC_ACCOUNT=<your Joyent Cloud account name>
export SDC_KEY_ID=<the fingerprint of one of your SSH keys in Joyent Cloud>

For SDC_URL choose the datacenter that hosts your instances, or the one closest to you:

Datacenter URL Location Virginia, USA San Francisco Area, USA Las Vegas, USA Amsterdam, Netherlands

You can find the SSH fingerprint for your keys in the Joyent Cloud Portal under My Account > SSH Keys.

For example, your setup might look something like this:

export SDC_URL=
export SDC_ACCOUNT=example
export SDC_KEY_ID=7e:37:9b:11:b6:dc:99:be:1a:fd:95:23:73:ea:42:9e

Test that everything is set up correctly:

$ sdc-listdatacenters
  "us-east-1": "",
  "us-west-1": "",
  "us-sw-1": "",
  "eu-ams-1": ""