Home > ec2ubuntu

ec2ubuntu

Ec2ubuntu is a project mainly written in ..., it's free.

Intended to build 10.04 ami - Inspired from http://ec2ubuntu.googlecode.com/svn/trunk

arch=i386 | amd64 ami= ami-88f504e1 | ami-f8f40591

instanceid=$(ec2-run-instances --key chronus-ec2-keypair --availability-zone us-east-1a | egrep ^INSTANCE | cut -f2) echo "instanceid=$instanceid"

while host=$(ec2-describe-instances "$instanceid" | egrep ^INSTANCE | cut -f4) && test -z $host; do echo -n .; sleep 1; done echo host=$host

For EBS following additional steps are required

  1. Create an ebs volume of size 10GB on the same availability zone as the target server. Verify the availability zone of the server before doing this because if the volume is created in a different machine, it won't be accessible!! ec2-create-volume --size 10 --availability-zone us-east-1a
  2. Wait for the volume to be created (check status by doing ) ec2dvol
  3. Boot an instance using the above steps
  4. Attach the volume to the target instance: (note target instance needs to be present in same avialabilty zone) ec2-attach-volume -i $instanceid -d /dev/sdh
  5. Verify if the attachment has happened: ec2-describe-volumes
  6. Login to the instance and mount the volume mkfs -t ext3 /dev/sdh mkdir -p /mnt/build mount /dev/sdh /mnt/build

These are common for both instance store and ebs rsync --rsh="ssh" --rsync-path="sudo rsync" ~/ec2_keys/{cert,pk}-.pem ubuntu@$host:/mnt/ rsync -rlvzcC --delete --exclude='output' --rsync-path="sudo rsync" --exclude='.git' --rsh='ssh' rails_apps/ec2onrails ubuntu@$host:/mnt/ rsync -rlvzcC --delete --exclude='output*' --rsync-path="sudo rsync" --rsh='ssh' rails_apps/ec2ubuntu ubuntu@$host:/mnt/

ssh ubuntu@$host

sudo -i -u root has_multi=grep multiverse /etc/apt/sources.list if [ "" = "$has_multi" ] ; then echo "deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse" >> /etc/apt/sources.list echo "deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse" >> /etc/apt/sources.list echo "deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse" >> /etc/apt/sources.list echo "deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse" >> /etc/apt/sources.list apt-get -y update fi

apt-get install -y ec2-api-tools ec2-ami-tools

For EBS you should not pass bucket, prefix but pass --ebs ruby /mnt/ec2onrails/server/build --bucket testeconrails --prefix ec2onrails-custom --arch --user USERID --access-key ACCESS_KEY --secret-key SECRET KEY --private-key PRIVATE_KEY --cert CERT

ec2-register --name "testeconrails/ec2onrails-custom" testeconrails/ec2onrails-custom.manifest.xml --private-key PRIVATE_KEY --cert CERT

ec2-terminate-instances $instanceid