Bundling an Euca Instance, euca-bundle-vol: SOLVED

I hope some of you who have been following me are as anxious to know what happened, than I was to find the solution to this euca-bundle-vol issue.

Well it has worked eventually thanks to this forum post. I know there is enough information there but I will still write what I did, in more detail. And I was suprised that it wasn’t documented by now. At least I did not find it till now. So here we go.

I have done this an Karmic server instance, running on the Karmic UEC. There must be similar steps for CentOS and Fedora which I guess someone will leave a comment on.

The catch it seems is to download the latest euca2ools, and it worked magic, thanks Kiran for pointing me to the forum post and I hope this post will help you in you manual preparation for UEC.

I first download the latest euca2ools and its dependencies onto the instance.

# wget http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/euca2ools-1.2.tar.gz&nid=1346
# wget http://open.eucalyptus.com/sites/all/modules/pubdlcnt/pubdlcnt.php?file=http://eucalyptussoftware.com/downloads/releases/euca2ools-1.2-src-deps.tar.gz&nid=1346

Make sure you have removed the existing euca2ools from the instance, as they might pose an issue later.

# apt-get remove euca2ools

Just an aside, i created a 4G EBS volume and attached to the instance; formatted it to ext3 and mounted it to /mnt/bundle directory. This were I will keep all my need artifacts.

Then I went ahead with installing the dependencies, but before that you need to install python-dev, libssl-dev and swig which are required by the dependencies

# apt-get install python-dev libssl-dev swig
# tar -xvf euca2ools-1.2-src-deps.tar.gz
# mv euca2ools-1.2-src-deps.tar.gz /mnt/bundle/
# cd euca2ools-1.2-src-deps/
# tar -xvf boto-1.8d.tar.gz
# cd boto-1.8d/
# python setup.py install
# cd ..
# tar -xvf M2Crypto-0.19.1.tar.gz
# cd M2Crypto-0.19.1/
# make

I set the PATH and PYTHONPATH appropriately at this point. Just to make things a little easier.

# export PATH=/usr/local/bin:$PATH
# export PYTHONPATH=/usr/lib/python2.6/dist-packages:$PYTHONPATH

I installed the euca2ools at this moment

# tar -xvf euca2ools-1.2.tar.gz
# mv euca2ools-1.2.tar.gz /mnt/bundle/
# cd euca2ools-1.2/
# make install

I got my eucalyptus credentials through sftp and moved them to /mnt/bundle, uzipped and sourced the eucarc

# mv mycreds.zip /mnt/bundle/
# cd /mnt/bundle/
# unzip mycreds.zip
# . eucarc

NOTE: Its important to do this as these credentials are bundled with the AMI, as /mnt is excluded by default.

Now I went ahead removed the udev rules for this instance.

# cd /etc/udev/rules.d/
# ls
# rm 70*

Why should we do this? Here is why!

Now I have completed all the prebundle steps. I just had to bundle the instance now. And this is three part step which involves; bundle, upload and register.

# euca-bundle-vol -c $EC2_CERT -k $EC2_PRIVATE_KEY -u $EC2_USER_ID --ec2cert $EUCALYPTUS_CERT --kernel eki-F69610EE --ramdisk eri-0B3A116D -d /mnt/bundle -p sam-img1 -s 2048 -r x86_64
1+0 records in
1+0 records out
1048576 bytes (1.0 MB) copied, 0.00358811 s, 292 MB/s
mke2fs 1.41.9 (22-Aug-2009)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
131072 inodes, 524288 blocks
26214 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=536870912
16 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
 32768, 98304, 163840, 229376, 294912

Writing inode tables: done
Creating journal (16384 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 39 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
Checking image
Tarring image
Encrypting image
Splitting image...
Part: sam-img1.part.0
Part: sam-img1.part.1
Part: sam-img1.part.2
Part: sam-img1.part.3
Part: sam-img1.part.4
Part: sam-img1.part.5
Part: sam-img1.part.6
Part: sam-img1.part.7
Part: sam-img1.part.8
Part: sam-img1.part.9
Part: sam-img1.part.10
Part: sam-img1.part.11
Part: sam-img1.part.12
Part: sam-img1.part.13
Part: sam-img1.part.14
Part: sam-img1.part.15
Part: sam-img1.part.16
Part: sam-img1.part.17
Part: sam-img1.part.18
Part: sam-img1.part.19
Part: sam-img1.part.20
Part: sam-img1.part.21
Part: sam-img1.part.22
Generating manifest /mnt/bundle/sam-img1.manifest.xml

# euca-upload-bundle -b samkabukkit -m /mnt/bundle/sam-img1.manifest.xml
Checking bucket: samkabukkit
Creating bucket: samkabukkit
Uploading manifest file
Uploading part: sam-img1.part.0
Uploading part: sam-img1.part.1
Uploading part: sam-img1.part.2
Uploading part: sam-img1.part.3
Uploading part: sam-img1.part.4
Uploading part: sam-img1.part.5
Uploading part: sam-img1.part.6
Uploading part: sam-img1.part.7
Uploading part: sam-img1.part.8
Uploading part: sam-img1.part.9
Uploading part: sam-img1.part.10
Uploading part: sam-img1.part.11
Uploading part: sam-img1.part.12
Uploading part: sam-img1.part.13
Uploading part: sam-img1.part.14
Uploading part: sam-img1.part.15
Uploading part: sam-img1.part.16
Uploading part: sam-img1.part.17
Uploading part: sam-img1.part.18
Uploading part: sam-img1.part.19
Uploading part: sam-img1.part.20
Uploading part: sam-img1.part.21
Uploading part: sam-img1.part.22
Uploaded image as samkabukkit/sam-img1.manifest.xml

# euca-register samkabukkit/sam-img1.manifest.xml
IMAGE    emi-90050F49

And raised an instance of that emi and it worked beautifully.

Couple of things to note here

If your Eucalyptus environment is not running in MANAGED networking mode, or if you’re bundling an existing system either physical or virtual not running on Eucalyptus, use the –no-inherit option. The euca-bundle-vol command will attempt to contact the Eucalyptus metadata server to implant instance information into your bundled image, but this only works in MANAGED mode.

Please make sure you’ve excluded ALL networking configuration from the bundled image, including MAC address settings and DHCP leases, and make sure that the system is configured in DHCP mode. This you could do my adding the “-e /var/lib/dhclient” to the euca-bundle-vol command.

I wish and hope that it works for you as well. Cheers!


One thought on “Bundling an Euca Instance, euca-bundle-vol: SOLVED

  1. Hi,

    I have one question. I want to include a script & a text file in the /root directory of the Ubuntu 11.04 image while bundling. Do I need to mention it separately or will both these files from /root directory will automatically be bundled?


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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