Building Cloud Infrastructure Using the Python SDK

The Python SDK for the ProfitBricks API is the first library that has been exclusively built for and in support of the ProfitBricks REST API. This library is a bit different than our previous open-source contribution to the Python community (support for the popular Libcloud a multi-cloud library and part of the Apache community of top-level projects), in that it both abstracts and provides complete coverage for all current API functions.

The library is very specific to ProfitBricks, and exposes advanced functionality you may not find in another cloud-agnostic multi-cloud library like jclouds or Libcloud. We’re very proud of this new addition to Python and ProfitBricks!

Why Python?

While it doesn’t hold the number one spot as far as usage is concerned, Python is amazingly popular across the developer community, especially with DevOps professionals that are automating cloud computing infrastructure. It sits happily in place number four, according to the IEEE; however, it’s popularity only continues to increase as it is also the most taught language in the computer science departments on our campuses. Python is efficient, and for an interpreted language – aka, a language whose program is not compiled by the computer but rather given in as instructions from the developer – it is quite fast. The language is broadly supported, with PyPi offering 57K packages.

When you add all these facts together, you see why we chose Python as our first release with the ProfitBricks REST API.

Overview

The library exposes a number of functions which all map back to the REST API. You can find full documentation on the various aspects of the new API here, and browse the Python repository here. We have taken the approach of keeping the code simple and Pythonic; however, the library supports both simple and complex requests. This is covered in more detail in our samples.

Code Samples

Once you’ve followed our getting started guide you should have the module available in your environment. You can perform simple requests such as creating an empty Virtual Data Center.

But, this isn’t any fun nor of much use. As mentioned earlier, the library supports complex creates, too. You can create a server with multiple NICs and then attach it to a boot volume and a data volume in a single request like so:

Summary:

The Python library creates a powerful interface to the REST API. With unlimited private networks, a developer can automate the creation of cluster environments where different services are segmented into different networks. All volumes get created on an ultra-fast disk subsystem which creates a compelling case for things like nice Big Data farms where I/O is tantamount; our library is excellent for doing these and other types of build outs automatically and at scale.

We will continue to improve and build upon this version one release of the Python SDK. We also welcome contributions back into the project and, as always, you can engage with the community over at the DevOps Central community website. Or perhaps, you might want to sign-up for the ProfitBricks DevOps Central account and get a 33% discount off ProfitBricks’ award winning IaaS platform.

Python illustration for ProfitBricks - save 33 percent