1

I am experiencing difficulty trying to launch a AMI from an EBS volume. I am basically trying to launch another instance of a Linux (i386) based AMI that I have already configured the way I want. I have followed many guides for the past week. So far, I am able to create the custom private AMI but I am unable to connect to it after launching the new instance. I suspect that the AMI I have created is miss-configured in some way (maybe files didnt get fully copied over).

Anyhow here are the basic steps I'm going through to try to create the AMI:

ec2-create-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem --size 10 --availability-zone us-east-1a

ec2-attach-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx --instance xxxxxx --device /dev/sdh

yes | mkfs -t ext3 /dev/sdh mkdir/mnt/ebsimage

echo '/dev/sdh /mnt/ebsimage ext3 defaults,noatime 0 0' >> /etc/fstab

mount /mnt/ebsimage

umount /mnt/ebsimage

ec2-detach-volume -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx --instance xxxxxx

ec2-create-snapshot -K pk-xxxxxx.pem -C cert-xxxxxx.pem vol-xxxxxx

ec2reg -K pk-xxxxxx.pem -C cert-xxxxxx.pem -s snap-xxxxx -a i386 -d -n --kernel aki-xxxxx --ramdisk ari-xxxxxx

I'm pretty sure either my commands around mount are messed up or my commands around ec2reg are messed up. Any suggestions?


I have also tried replacing

yes | mkfs -t ext3 /dev/sdh

mkdir/mnt/ebsimage

echo '/dev/sdh /mnt/ebsimage ext3 defaults,noatime 0 0' >> /etc/fstab

mount /mnt/ebsimage

with a script designed to use rsync and add some other details but again the new instance of the ami launched cannot be connected to. Here is a copy of the script.

#!/bin/sh
vol=/dev/sdh
ebsmnt=/mnt/ebsimage
mkdir ${ebsmnt}
mkfs.ext3 -F ${vol}
sync
echo "mount $vol $ebsmnt"
mount $vol $ebsmnt
mkdir ${ebsmnt}/mnt
mkdir ${ebsmnt}/proc
mkdir ${ebsmnt}/sys
devdir=${ebsmnt}/dev
echo "mkdir ${devdir}"
mkdir ${devdir}
mknod ${devdir}/null    c 1 3
mknod ${devdir}/zero    c 1 5
mknod ${devdir}/tty     c 5 0
mknod ${devdir}/console c 5 1
ln -s null ${devdir}/X0R
rsync -rlpgoD -t -r -S -l -vh \
--exclude /sys --exclude /proc \
--exclude /dev \
--exclude /media --exclude /mnt \
--exclude /sys --exclude /ebs --exclude /mnt \
-x /* ${ebsmnt}
df -h

Because I have the same results as the first example, I'm not sure if I'm closer to solving this issue or further away. Any help would be appreciated.

Sampson
  • 265,109
  • 74
  • 539
  • 565
David Gill
  • 8,411
  • 5
  • 19
  • 21
  • I have also tried rsync. I have had the same results with using that command. – David Gill Mar 05 '11 at 22:44
  • All my ports should be configured correctly on the device. I used the same settings as the original image when launching the new AMI. – David Gill Mar 06 '11 at 17:30
  • I guess that question is complex enough that a lot of people will avoid. I don't know the answer, but I found a superb consultant on cloud stuff that's very reasonable. I'm not sure if such a referral is allowed on this site, but any questions like this I have, I just email him and get the answer back pretty quick. We're only a 2 man company but this is one of those cases where you save a lot in the long term. – Frodo Baggins Mar 06 '11 at 20:22
  • Sounds incredibly useful. Can you use the contact form on my website listed for this account to provide me with more details on this? – David Gill Mar 06 '11 at 21:01

2 Answers2

0

I don't know which distribution you are trying to run, but if you want to run debian, there is a script which manages the entire bootstrapping process including ami creation (EBS boot).

You can find it on my github account: https://github.com/andsens/ec2debian-build-ami

The script has been thoroughly tested and allows you to include other scripts in order to customize your ami. If you want to modify the script itself, just fork it, at least you then have a base to work from, where you know everything works.

I would not recommend the process you outlined though, it seems quite 'messy'.

andsens
  • 6,716
  • 4
  • 30
  • 26
0

To create your EBS AMI from an S3 based AMI, you can use my blog post: http://www.capsunlock.net/2009/12/create-ebs-boot-ami.html

Rodney Quillo
  • 3,312
  • 1
  • 18
  • 9