Getting Started

Installation (stable version)

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

  1. pip install apache-libcloud

Installation (development version)

You can install latest development version from our Git repository:

  1. pip install -e git+https://git-wip-us.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud

Upgrading

If you used pip to install the library you can also use it to upgrade it:

  1. pip install --upgrade apache-libcloud

Using it

This section describes a standard work-flow which you follow when workingwith any of the Libcloud drivers.

  • Obtain reference to the provider driver
  1. from pprint import pprint
  2.  
  3. import libcloud
  4.  
  5. cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE)
  • Instantiate the driver with your provider credentials
  1. driver = cls('my username', 'my api key')

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

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

  • Start using the driver
  1. pprint(driver.list_sizes())
  2. pprint(driver.list_nodes())
  • Putting it all together
  1. from pprint import pprint
  2.  
  3. import libcloud
  4.  
  5. cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE)
  6.  
  7. driver = cls('my username', 'my api key')
  8.  
  9. pprint(driver.list_sizes())
  10. pprint(driver.list_nodes())

You can find more examples with common patterns which can help you get startedon the Compute Examples page.

Where to go from here?

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

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