🚀 Think you’ve got what it takes for a career in Data? Find out in just one minute!

Apache Libcloud: What is it? What’s it for?

-
2
 m de lecture
-
Apache Libcloud: What is it? What's it for?

Cloud computing is an exceptional technological evolution, but not without its complexities for developers. Managing multiple resources and differences in APIs and functionalities can turn into a never-ending, time-consuming headache.

Apache Libcloud is an open-source Python library that developers can use to hide the differences between the APIs of different cloud services such as Amazon, Rackspace, GoGrid, IBM Cloud and Linode. A simple, unified API makes cloud deployment more intuitive.

In 2009, the Libcloud library was integrated into the Apache incubator. The code was designed by developers at Cloudkick (now acquired by Rackspace). Subsequently, other developers from companies such as IBM and Linode added enhancements to the code.

A project management committee was set up to optimize code development: Apache made it a priority project of its foundation.

So, what’s the point of Apache Libcloud? How does this Python library work? How do you install and use it? Answers to all your questions in this article.

What is Apache Libcloud?

Apache Libcloud is an open-source Python library designed to interact with various cloud services such as Amazon Web Services (AWS), Microsoft Azure, Google Cloud Platform (GCP) and many others. Learn more about the specifics of each service and their APIs: Apache Libloud lets you use the same API to manage different cloud resources. So you use a single interface to manage over 30 cloud services.

 

💡Related articles:

Apache Ambari: A tool to simplify Hadoop cluster management
Apache Storm: Explanations and Use cases
Understanding Apache Flume: Its Purpose and Applications
DevOps training: how to master GitHub, Docker or Apache Airflow?
Apache Ant: The Basics

How does Apache Libcloud work?

The main advantage of Apache Libcloud is its unified API. In fact, Libcloud offers a single API for communicating with different cloud services. Developers can therefore use the same API methods, regardless of cloud provider. This saves considerable time and simplifies the development process.

This unified API works thanks to key elements of Libcloud called “drivers”. These drivers are adapters between the unified API and the APIs of each cloud service. Libcloud does not offer all of the vendor’s functionalities. However, it does include the main tools: create, reboot, list or destroy entities. Users can therefore avoid vendor lock-in.

How do I install and use Apache Libcloud?

Libcloud is available on PyPi. You can install the latest version using the pip command:
pip install apache-libcloud
You can also install the latest development version from the Apache Git Repository:
pip install -e git+https://git.apache.org/repos/asf/libcloud.git@trunk#egg=apache-libcloud

To update the library: 

pip install --upgrade apache-libcloud

 

To use the Apache Libcloud library, here’s a standard workflow for working with all Libcloud drivers.

Step 1: Get the supplier's driver part number

from pprint import pprint
. import libcloud cls = libcloud.get_driver(libcloud.DriverType.COMPUTE, libcloud.DriverType.COMPUTE.RACKSPACE)

Step 2: Initialize the driver with your supplier's credentials

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

Bear in mind that some drivers require additional elements such as “region” or “api_version”. Take a look at the supplier’s documentation.

Step 3: Using the driver

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

Step 4: Assemble the code

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())

Once you’ve understood this workflow, you can read up on the APIs you’re interested in.

Apache Libcloud at a glance

Apache Libcloud is a Python library enabling developers to use a single API to communicate and deploy their code across all cloud services. Thanks to its drivers and single API, developers save considerable time.

They can use features such as code modification or entity deletion, and benefit from an active community around the project. Libcloud is easy to install and use, making it a real asset for corporate tech teams.

Facebook
Twitter
LinkedIn

DataScientest News

Sign up for our Newsletter to receive our guides, tutorials, events, and the latest news directly in your inbox.

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter

DataNews

Get monthly insider insights from experts directly in your mailbox