You have access to the CloudStack API - it allows you to completely automate the provisioning and management of your domain.

LeaseWeb Apache CloudStack Private Cloud - API

The CloudStack programmer guide is the reference guide on how to create API requests and how to interpret resulting the responses. Programming against the API requires familiarity with HTTP GET/POST methods, query strings, and either XML or JSON and how to generate those in the programming language of your choice. 

In addition to programming requests and custom integration, the API is also used by a number of cloud infrastructure management, provisioning, and orchestration tools, and it can even be accessed from a command line. Examples of those include:

API end point URLs

The API end points are specific for each data center location from which LeaseWeb offers Apache CloudStack Private Cloud infrastructures.

Currently available are:


Set up API access


To use the API, a domain administrator will need to associate an user account with a generated key pair containing both an API and the Secret Key.

It is strongly recommended that the domain administrator doesn't use the account LeaseWeb provided for API access and will create additional CloudStack accounts first. Once the additional account(s) have been created, the domain administrator can use the web interface and the menu “Accounts” → “your-domain” → “Users”  →  “Account Name” to generate a new API and Secret Key pair for that Account. The Account type "Domain Administrator" or "User" determines which API functionality will be available.

CloudStack will generate a unique key pair with both a Secret and an API key. 

The clip-board icon next to the Secret and API keys should be used to select the keys for copying, because the web interface won’t display the complete key and selecting the key with a mouse may otherwise result in missing characters.


Install cloudmonkey

Cloudmonkey is a front-end to the API that offers both an interactive shell and a command line tool that allows you to quickly get started with automation, without the need of programming.  

Based on the Python CS library, cloudmonkey is also a python package that will probably run in any environment that supports a recent Python version. 

The recommended installation method is with the python package manager pip, although if that is unavailable, easy_install will most likely work as a substitute. 


Cloudmonkey can easily be installed on OSX from a command line with pip:

install cloudmonkey on OSX


Most Debian and Ubuntu versions have a ready made package for pip :

install cloudmonkey on Debian/Ubuntu



The default RHEL and CentOS yum repositories don’t offer the recommended pip package manager. The optional EPEL repositories includes RPM packages for pip and for installing cloudmonkey (and other software as well), enabling them is recommended.

install cloudmonkey on RHEL/CentOS with epel


For administrators that don't want to enable EPEL, cloudmonkey can still be installed using the easy_install package installer instead of pip

install cloudmonkey on RHEL/CentOS with easy_install

Configure cloudmonkey for first use

Before cloudmonkey can be used, it needs to be configured with the correct settings and credentials.

We start by launching cloudmonkey from a terminal prompt, and from the interactive cloudmonkey shell, creating a profile named “LeaseWeb” with default values. 

cloudmonkey - create profile

Then update the default values with the correct settings and personal keys to manage the private cloud:

cloudmonkey - update profile

The URL depends on which datacenter is hosting the private cloud and can be found in the table at the top of this page.  

The profile will automatically get stored in the ~/.cloudmonkey/config file and will be set as default. Multiple profiles can be created for Accounts with different privilige levels or for different API end points. Either the cloudmonkey -p ProfileName command line switch or the interactive "set profile ProfileName" can be used to select and switch to the desired profile.

The sync command will both work as test for the connection settings and will also ensure that cloudmonkey TAB completion will only suggest supported commands. The number of discoverd APIs will depend on the CloudStack version and the access level of the Account.

cloudmonkey - sync and test profile


Using cloudmonkey

Cloudmkonkey can be used as an interactive shell with autocomplete and history functionality by starting it from the commandline:

Usage - interactive shell


Alternatively use it as a command line utility:

Usage - command line utility


Cloudmonkey can also be scripted. Simply create a file with any number of commands on individual lines:

Usage - script

For both the command line (with the –d switch) as well as in interactive mode, you can define how the output should get displayed JSON, XML, tabular, CSV, etc:

Usage - set output format


A filter can be used to limit which fields will get returned :

Usage - filter to limit output


Certain API queries take optional request parameters. For instance the listUsers API call allows among others to list users by username. The % symbol allows wildcard matching:

Usage - matching to limit output


Automating common tasks 

Below are some code snippets, cloudmonkey, and shell scripts that illustrate how to perform common tasks.


Display what resources are assigned to a private cloud domain, what is currently in use and how much is still available:

Automation - usage reporting


Reporting on users:

Automation - report on users


Create a new user under an existing Account, change the password, create API keys and disable and remove an account. 

The createUser API function requires that the account is accompanied with a domainID, so that will need to be retrieved first.

Automation - maintain users




You can click on any of the keywords below this article to see all related articles for that keyword