Hybrid Cloud Orchestration and Control using Python

Hybrid cloud is a fussy word catching up in the IT industry. Organizations still migrating their workloads to cloud, but the confusion exists between Public and private cloud. Organizations who are moved their workloads to cloud are thinking about Hybrid Cloud or Multi cloud due to various reasons. Let us see what hybrid cloud is and how its differ from multi cloud environment

Hybrid Cloud

As we see organizations were migrated their workloads from own data center to public cloud, there are organizations are not completely moved their mission critical or legacy application into public cloud for various reasons, later they may have migrate to private hosting within DC or hosted DC using VMware or Openstack. So the organizations who are using public and private hosting are calling it as hybrid cloud environment.

The definition of hybrid cloud from Redhat

Hybrid cloud is an IT architecture that incorporates some degree of workload portability, orchestration, and management across 2 or more environments. Depending on whom you ask, those environments may need to include:

· At least 1 private cloud and at least 1 public cloud

· 2 or more private clouds

· 2 or more public clouds

· A bare-metal or virtual environment connected to at least 1 cloud — public or private

Multi cloud

Organizations moved their DC to public cloud but they might have concern on risk associated with dependency of single vendor. In order to mitigate the risk they decide and migrated to one or more public cloud providers whom call the environment as multi cloud

How hybrid cloud works and how secure it is?

The way private cloud work is connected through Local Area Network (LAN) for their DC, may be Wide Area Network (WAN) for their hosted DC. The same way public cloud also works except LAN and VPN for securely connect. Another connecting mechanism to control and manage Hybrid cloud is Application Programing Interfaces (APIs)

Why APIs are required in Hybrid Cloud?

There are native tools from each public and private cloud providers to manage, monitor and control. When you think to control, automate, manage and monitor from single end point or program the APIs are helping to achieve your goal. Ok, I have APIs from multiple providers it may require opening ports for API to connect multiple providers, may require to Install Libraries or software module for multiple providers. Is there any solution to handle multiple providers in a simple way? The answer is Yes, we can manage, control, automate, monitor Hybrid cloud simply using Python code

Apache Libcloud

Apache Libcloud is a Python library which hides differences between different cloud provider APIs and allows you to manage different cloud resources through a unified and easy to use API. Using Libcloud in your python code you can manage, control, automate and monitor the public and private cloud resources

Libcloud mainly eliminates vendor lock-in and supports single API for more than 30 providers


Supports Python 3, PyPy (3.x and 2.x) and Python 2.7

pip install apache-libcloud

Simple example shows create node multiple providers


from libcloud.compute.types import Provider

from libcloud.compute.providers import get_driver

ACCESS_ID = ‘your access id’

SECRET_KEY = ‘your secret key’

SIZE_ID = ‘t1.micro’

# Name of the existing keypair you want to use

KEYPAIR_NAME = ‘keypairname’

# A list of security groups you want this node to be added to

SECURITY_GROUP_NAMES = [‘secgroup1’, ‘secgroup2’]

cls = get_driver(Provider.EC2)

driver = cls(ACCESS_ID, SECRET_KEY)

sizes = driver.list_sizes()

images = driver.list_images()

size = [s for s in sizes if s.id == ‘t1.micro’][0]

image = images[0]

node = driver.create_node(name=’test-node-1', image=image, size=size,



Create an OpenStack node

from libcloud.compute.providers import get_driver

import libcloud.security

libcloud.security.VERIFY_SSL_CERT = False

OpenStack = get_driver(Provider.OPENSTACK)

driver = OpenStack('your_auth_username', 'your_auth_password',



nodes = driver.list_nodes()

images = driver.list_images()

sizes = driver.list_sizes()

size = [s for s in sizes if s.ram == 512][0]

image = [i for i in images if i.name == 'natty-server-cloudimg-amd64'][0]

node = driver.create_node(name='test node', image=image, size=size)

What else I can do with Libcloud?

Libcloud supports not only node provisioning for multi cloud providers, we can manage and control key pairs, Load balancers, storages and DNS


Libcloud simple python library for manage and control multiple public and private cloud providers. It’s very simple and powerful and there are plenty of Cloud Management Platform (CMP) third party tools using Libcloud. But it is limited to Python programs only and for Java, apache provides Jclouds library to control and manage the hybrid cloud

For more examples and automation, please visit https://github.com/ngopi37