First, be sure to source your 'eucarc' file before running the commands below. Note that all users may upload and register images (depending on access granted to them by the Eucalyptus administrator), but only the admin user may ever upload/register kernels or ramdisks.
The latest version of EC2 API and AMI tools that we support are ec2-api-tools-1.3-30349 and ec2-ami-tools-1.3-26357. Download BOTH before proceeding, if you have not done so already.
To enable a VM image as an executable entity, a user/admin must add a root disk image, a kernel/ramdisk pair (ramdisk may be optional) to Walrus and register the uploaded data with Eucalyptus. Each is added to Walrus and registered with Eucalyptus separately, using three EC2 commands. The following example uses the test image that we provide. Unpack it to any directory:
Add the kernel to Walrus, and register it with Eucalyptus (WARNING: your bucket names must not end with a slash!):
ec2-bundle-image -i <kernel file> --kernel true ec2-upload-bundle -b <kernel bucket> -m /tmp/<kernel file>.manifest.xml ec2-register <kernel-bucket>/<kernel file>.manifest.xml
Next, add the root filesystem image to Walrus:
ec2-bundle-image -i <vm image file> ec2-upload-bundle -b <image bucket> -m /tmp/<vm image file>.manifest.xml ec2-register <image bucket>/<vm image file>.manifest.xml
Our test kernel does not require a ramdisk to boot. If the administrator would like to upload/register a kernel/ramdisk pair, the procedure is similar to the above:
ec2-bundle-image -i <initrd file> --ramdisk true ec2-upload-bundle -b <initrd bucket> -m <initrd file>.manifest.xml ec2-register <initrd bucket>/<initrd file>.manifest.xml
There are three ways that one can associate a kernel (and ramdisk) with a VM instance.
ec2-bundle-image -i <vm image file> --kernel <eki-XXXXXXXX> --ramdisk <eri-XXXXXXXX>
ec2-run-instances <emi-XXXXXXXX> --kernel <eki-XXXXXXXX> --ramdisk <eri-XXXXXXXX>
In order to delete an image, you must first de-register the image:
ec2-deregister <emi-XXXXXXXX>
Then, you can remove the files stored in your bucket. Assuming you have sourced your 'eucarc' to set up EC2 client tools:
ec2-delete-bundle -a $EC2_ACCESS_KEY -s $EC2_SECRET_KEY --url $S3_URL -b <bucket> -p <file prefix>
If you would like to remove the image and the bucket, add the '--clear' option:
ec2-delete-bundle -a $EC2_ACCESS_KEY -s $EC2_SECRET_KEY --url $S3_URL -b <bucket> -p <file prefix> --clear
Following is an example using the 'ttylinux' image for Xen:
cd $EUCALYPTUS_SRC/eucalyptus-src-deps tar zxvf euca-ttylinux.tgz ec2-bundle-image -i ttylinux/vmlinuz-2.6.16.33-xen --kernel true ec2-upload-bundle -b kernel-bucket -m /tmp/vmlinuz-2.6.16.33-xen.manifest.xml ec2-register kernel-bucket/vmlinuz-2.6.16.33-xen.manifest.xml ec2-bundle-image -i ttylinux/ttylinux.img ec2-upload-bundle -b image-bucket -m /tmp/ttylinux.img.manifest.xml ec2-register image-bucket/ttylinux.img.manifest.xml
Next is an example using the Ubuntu pre-packaged image that we provide using the included KVM compatible kernel/ramdisk (a Xen compatible kernel/ramdisk is also included). See this page to get more pre-packaged images.
tar zxvf euca-ubuntu-9.04-x86_64.tar.gz ec2-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/vmlinuz-2.6.28-11-generic --kernel true ec2-upload-bundle -b ubuntu-kernel-bucket -m /tmp/vmlinuz-2.6.28-11-generic.manifest.xml ec2-register ubuntu-kernel-bucket/vmlinuz-2.6.28-11-generic.manifest.xml (set the printed eki to $EKI) ec2-bundle-image -i euca-ubuntu-9.04-x86_64/kvm-kernel/initrd.img-2.6.28-11-generic --ramdisk true ec2-upload-bundle -b ubuntu-ramdisk-bucket -m /tmp/initrd.img-2.6.28-11-generic.manifest.xml ec2-register ubuntu-ramdisk-bucket/initrd.img-2.6.28-11-generic.manifest.xml (set the printed eri to $ERI) ec2-bundle-image -i euca-ubuntu-9.04-x86_64/ubuntu.9-04.x86-64.img --kernel $EKI --ramdisk $ERI ec2-upload-bundle -b ubuntu-image-bucket -m /tmp/ubuntu.9-04.x86-64.img.manifest.xml ec2-register ubuntu-image-bucket/ubuntu.9-04.x86-64.img.manifest.xml
Now, the newly uploaded image(s) should be ready to start using (see User's Guide for more information on using Eucalyptus).