Bundling EC2 Instances and EBS

As I mentioned in the last post, I’m working on hosting email accounts on Amazon EC2. I am experimenting with mounting /var on an EBS volume so my database, logs, etc. will survive the failure of an instance.  The idea is to be able to start a new instance, attach the EBS volume containing the /var partition, and keep going where the previous instance left off.  

The first time I tried to bundle the volume I noticed it was taking a very long time.  I had incorrectly assumed that ec2-bundle-vol would automatically exclude any EBS volumes.  Instead, it only excludes a static list of directories, so I had to add the EBS volume (/mail) to the exclusion list.  

Here are the commands I used to bundle the volume:

ec2-bundle-vol -k /mnt/aws-config/pk-xxxxx.pem \
-c /mnt/aws-config/cert-xxxx.pem \
-u xxxx-xxxx-xxxx -d /mnt/bundle \
-p image-name-20080924
-e /mail

ec2-upload-bundle -b ae-ami \
-m /mnt/bundle/image-name-20080924.manifest.xml \
-a xxxx -s xxxx

ec2reg bucket-name/image-name-20080924.manifest.xml

 

 

The next step will be to figure out how to set up the AMI so it will have a swap partition when it boots up in a new instance.

This entry was posted in sysadmin and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *