Using Cloud images with standalone Hypervisors

Most of the cloud images (centos, ubuntu, fedora) published by Distro builders are now conforming to Cloud-Init based initial configuration.

Cloud-Init is a method of providing configuration to the VM image when it boots up for the first time. It can be used to do initial setup/configuration like provision user login, service configuration, package installation etc. to name a few.

Most of the cloud images do not have any default user password set(to prevent any security risk due to well know password). To login to these Cloud Images on a VM you must provide the user auth configuration during the VM boot up using Cloud init, the same process can also be used to provide data related to the VM itself such as hostname, ip-address etc.

Cloud-init can get this data during the boot process through various sources (called data-sources) like http request to some well know IP, Config-drive etc.

While using these cloud images on a standalone Hypervisors like libvirt or virtualbox, it may not be practical to configure the infrastructure to provide the cloud init data over the network.

Fortunately, Cloud-Init can also use ISO image to get the Configuration Data for the VM

Here is a brief process of creating a ISO image for providing user auth data like ssh key/password and VM metadata using cloud image.

  • Create a ssh key pair

ssh-keygen -f my_ssh_key

  • Create a file named user-data to provide user related settings
password: mypassword
chpasswd: { expire: False }
ssh_pwauth: True
    - <paste your ssh pub key>
  • Create a file named meta-data to provide VM related data
instance-id: Atomic01
local-hostname: atomic-host-001
  • Create an ISO image

genisoimage -output atomic01-cidata.iso -volid cidata -joliet -rock user-data meta-data

  • Use this ISO image as the CDROM while booting the Cloud Image to provide the configuration to Cloud-Init
  • Now you can login to the VM using the ssh key (my_ssh_key) or password (mypassword) with the default username (e.g.  Ubuntu: use username ubuntu, for Centos: use centos etc.)

A sample ISO and related configuration data is available at this location.

The complete documentation for cloud-init is available here


Published by

Chandan Dutta Chowdhury

Software Engineer

One thought on “Using Cloud images with standalone Hypervisors”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s