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 the Cloud API including:
- Provision new machines (both SmartMachines and traditional Virtual Machines).
- Manage your account credentials.
- Create custom analytics for monitoring your infrastructure.
|Available Cloud API variables are not covered by this document. For reference information on the Cloud API, click here.|
In this topic:
Before you can use the CloudAPI, you must first install Node.js on a local system that you will use to interface with the CloudAPI. To install node.js, follow the instructions here.
The node-smartdc package is a Node.js client library that includes a CLI you can use to write scripts that support most every task that is possible through the CloudAPI. To interface with the CloudAPI, you need to install the node-smartdc package.
|Install this package globally so that CLI commands are always in your path.|
- Install the package.
- Set up the CLI:
The installer prompts you to set specific environment variables.
- Set the specified environment variables.
CLI Flag Description Environment Variable --account or -a Your account name on my.joyentcloud.com SDC_CLI_ACCOUNT --keyId or -k The name of your SSH key in my.joyentcloud.com SDC_CLI_KEY_ID --url or -u URL of the CloudAPI endpoint
For Joyent Public Cloud, this is https://api.joyentcloud.com
SDC_CLI_URL --identity or -i Path to the location of your SSH key
On a Macintosh, this is usually /Users/username/.ssh/id_rsa
The sdc-setup command will prompt you for your username and password, and upload your SSH key. All other CLI commands use your RSA private key for signing requests to the API instead of your password.
|If you see the error "Invalid Authorization header", ensure you are using an RSA key. Joyent SmartMachines do not support DSA keys at this time.|