Cloud Zone is brought to you in partnership with:

Free Software hacker for the last decade, I've been working on various projects like Debian, the awesome window manager, XCB or GNU Emacs. I can barely use any software without digging into it to improve or fix it. Especially if it's written in a language I enjoy, like C, Python or Lisp. Julien is a DZone MVB and is not an employee of DZone and has posted 16 posts at DZone. You can read more from them at their website. View Full User Profile

Cloud Tools for Debian

02.14.2013
| 2809 views |
  • submit to reddit

Recently, I've worked on the cloud utilities that are provided as standard in Ubuntu, and I ported them to Debian. Let's see how that brings Debian to the cloud!

Basics of a cloud image

When starting an instance on a IaaS platform, your instance image is raw, un-configured. Therefore, you need to have a way to configure it automagically at boot time, based on what you want to do with it. Usually, IaaS platforms provides for this a metadata server, like Amazon EC2 does. It's a special HTTP server listening on a special and hard-coded IP address that your instance can request to know basic information about itself, like its hostname, and retrieve basic user metadata to auto-configure itself. You can check the documentation about the OpenStack metadata service for more information.

Also, image have a predefined size at upload time. So when you run it on a platform, the disk size you request is usually bigger than the size of your image disk: you mayneed to resize and grow your image to use the full disk space that is allocated to your instance.

Needed tools

To run a cloud platform, and especially Amazon EC2 or OpenStack, you need to configure and update your image based on the context you're started in. This also includes extending your template image disk to use the full available disk size provided to the running instance.

Ubuntu provides a set of cloud utils, which is actually composed of different source packages (cloud-init, cloud-utils and clout-initiramfs-tools).

Combined, these 3 packages will allow you to run a number of step, from disk resize at boot time to Puppet configuration handling.

So Ubuntu got this working right a long time ago, but unfortunately, Debian was really late on that.

Until now.

I've worked on getting these into Debian, and you can now find these 3 packages adapted and uploaded to Debian sid.

All you need to do, is to build a Debian image and then run:

apt-get install cloud-init cloud-tools cloud-initiramfs-growroot

And voilà: at the next reboot, your instance will extend its root partition size to the full available disk size, and ask the metadata server to configure things like its hostname.

The packages sources are available on Debian's git server for cloud-utils and cloud-initramfs-tools and you can build them yourself until the packages are processed by ftp-master and get out of the NEW queue. cloud-init on the other hand is directly available in sid.

One of next steps would probably be to build or enhance a tool like vmbuilder to be able to build cloud-compatible Debian images with a simple command line.


 

Published at DZone with permission of Julien Danjou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)