Getting Started¶
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 out Git repository:
pip install -e 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:
pip install --upgrade apache-libcloud
Using it¶
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
from libcloud.compute.types import Provider
from libcloud.compute.providers import get_driver
cls = get_driver(Provider.RACKSPACE)
- Instantiate the driver with your provider credentials
driver = cls('my username', 'my api key')
- Start using the driver
pprint(driver.list_sizes())
pprint(driver.list_nodes())
- 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())
You can find more examples with common patterns which can help you get started on the Compute Examples page.