%BOOK_ENTITIES; ]>
Apache Libcloud There are many tools available to interface with the &PRODUCT; API. Apache Libcloud is one of those. In this section we provide a basic example of how to use Libcloud with &PRODUCT;. It assumes that you have access to a &PRODUCT; endpoint and that you have the API access key and secret key of a user. To install Libcloud refer to the libcloud website. If you are familiar with Pypi simply do: pip install apache-libcloud You should see the following output: pip install apache-libcloud Downloading/unpacking apache-libcloud Downloading apache-libcloud-0.12.4.tar.bz2 (376kB): 376kB downloaded Running setup.py egg_info for package apache-libcloud Installing collected packages: apache-libcloud Running setup.py install for apache-libcloud Successfully installed apache-libcloud Cleaning up... You can then open a Python interactive shell, create an instance of a &PRODUCT; driver and call the available methods via the libcloud API. >> from libcloud.compute.types import Provider >>> from libcloud.compute.providers import get_driver >>> Driver = get_driver(Provider.CLOUDSTACK) >>> apikey='plgWJfZK4gyS3mOMTVmjUVg-X-jlWlnfaUJ9GAbBbf9EdM-kAYMmAiLqzzq1ElZLYq_u38zCm0bewzGUdP66mg' >>> secretkey='VDaACYb0LV9eNjTetIOElcVQkvJck_J_QljX_FcHRj87ZKiy0z0ty0ZsYBkoXkY9b7eq1EhwJaw7FF3akA3KBQ' >>> host='http://localhost:8080' >>> path='/client/api' >>> conn=Driver(apikey,secretkey,secure='False',host='localhost:8080',path=path) >>> conn=Driver(key=apikey,secret=secretkey,secure=False,host='localhost',port='8080',path=path) >>> conn.list_images() [] >>> conn.list_sizes() [, , ] >>> images=conn.list_images() >>> offerings=conn.list_sizes() >>> node=conn.create_node(name='toto',image=images[0],size=offerings[0]) >>> help(node) >>> node.get_uuid() 'b1aa381ba1de7f2d5048e248848993d5a900984f' >>> node.name u'toto' ]]> One of the interesting use cases of Libcloud is that you can use multiple Cloud Providers, such as AWS, Rackspace, OpenNebula, vCloud and so on. You can then create Driver instances to each of these clouds and create your own multi cloud application.