Cloud Tools for Debian
Cloud Tools for Debian
Join the DZone community and get the full member experience.Join For Free
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.
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.
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 . See the original article here.
Opinions expressed by DZone contributors are their own.