Getting Started

This page contains short instructions on how to get up and running with Libcloud in just a couple of minutes.

For more in-depth instructions and examples, please refer to the documentation.

Installation (stable version)

Libcloud is available on PyPi. You can install latest stable version using pip:

pip install apache-libcloud

Installation (development version)

If you feel adventurous and want the latest and greatest, you can install latest development version from our Git repository:

pip install git+http://gitbox.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud

Keep in mind that trunk is usually under heavy development and can contain backward incompatible changes. You should only use it if you know what you are doing.

Using It

This section describes a standard work-flow which you follow when working with Libcloud drivers.

Code snippet bellow use compute API as an example, but exactly the same work-flow is followed also when working with other APIs.

1.. Obtain reference to the provider driver

from pprint import pprint

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

cls = get_driver(Provider.RACKSPACE)

2.. Instantiate the driver with your provider credentials

driver = cls('my username', 'my api key')

Keep in mind that some drivers take additional arguments such as region and api_version.

For more information on which arguments you can pass to your provider driver, see provider-specific documentation and the driver docstrings.

3.. Start using the driver

pprint(driver.list_sizes())
pprint(driver.list_nodes())

4.. Putting it all together

from pprint import pprint

from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver

cls = get_driver(Provider.RACKSPACE)
driver = cls('my username', 'my api key')

pprint(driver.list_sizes())
pprint(driver.list_nodes())

Where to go from here?

The best thing to do after understanding the basic driver work-flow is to visit the documentation chapter for the API you are interested in (Compute, Object Storage, Load Balance, DNS). Chapter for each API explains some basic terminology and things you need to know to make an effective use of that API.

After you have a good grasp of those basic concepts, you are encouraged to check the documentation for the provider you are interested in (if available) and usage examples. If the driver specific documentation for the provider you are interested in is not available yet, you are encouraged to check docstrings for that driver.