Installation (stable version)¶
Libcloud is available on PyPi. You can install latest stable version using pip:
pip install apache-libcloud
Installation (development version)¶
You can install latest development version from our Git repository:
pip install -e git+https://git-wip-us.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud
If you used pip to install the library you can also use it to upgrade it:
pip install --upgrade apache-libcloud
This section describes a standard work-flow which you follow when working with any of the Libcloud drivers.
- Obtain reference to the provider driver
from pprint import pprint import libcloud cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE)
- 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
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
- Putting it all together
from pprint import pprint import libcloud cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE) driver = cls('my username', 'my api key') pprint(driver.list_sizes()) pprint(driver.list_nodes())
You can find more examples with common patterns which can help you get started on the Compute Examples page.
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 Balancer, 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 driver specific documentation (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.