Differences between revisions 1 and 2
Revision 1 as of 2013-10-26 11:08:26
Size: 3122
Comment: Official Amazon Machine Images for the DebianInstaller (in construction)
Revision 2 as of 2013-10-26 11:14:16
Size: 3129
Comment: Install latest stable version of DebianInstaller
Deletions are marked like this. Additions are marked like this.
Line 91: Line 91:
DI_VERSION=20130430 DI_VERSION=20130613+deb7u1

Official Debian-Installer AMIs

Official Amazon Machine Images for the DebianInstaller

AMI build script

Not yet a script... This is run in the Asia North-East zone.

The procedure below runs a helper instance with an attached volume of 1 GiB, partitions it, downwoads Debian-Installer on it and sets up a PV-GRUB configuration file to boot the installer. The snapshot of the resulting volume is registered as a machine image.

# Using Ubuntu as long as we do not have Debian images with cloud-init enabled by default.
HELPER_AMI=ami-7609bb77 # Ubuntu 12.04 LTS Precise amd64 EBS (Asia North-East)

Start the instance with an extra volume of 1 GiB, which will persist after termination (/dev/sdb=:1:false). Pass the script that will format the volume and download Debian-Installer (see below).

HELPER_INSTANCE=$( euca-run-instances \
        --instance-initiated-shutdown-behavior terminate \
        --instance-type t1.micro \
        --block-device-mapping /dev/sdb=:1:false \
        --user-data-file install-debian-installer \
        $HELPER_AMI |
        tee /dev/stderr | grep INSTANCE | awk '{print $2}')

Wait that the boot finished.

while [ ! $(euca-describe-instances $HELPER_INSTANCE | grep INSTANCE | cut -f 6 | tee /dev/stderr) = "running" ]
    do sleep 30

Get the volume's identifier

TARGET_VOLUME=$( euca-describe-volumes |
        grep $HELPER_INSTANCE | grep '/dev/sdb' |
        tee /dev/stderr | awk '{print $2}')

Wait that the scripts shuts down the instance.

while [ ! $(euca-describe-instances $HELPER_INSTANCE | grep INSTANCE | cut -f 6 | tee /dev/stderr) = "terminated" ]
    do sleep 30

Snapshot the volume and register it as a machine image.

PV_KERNEL=aki-176bf516 # Boot PV-Grub (Asia North-East)

TARGET_SNAPSHOT=$( euca-create-snapshot $TARGET_VOLUME |
        tee /dev/stderr | awk '{print $2}')

while euca-describe-snapshots $TARGET_SNAPSHOT | grep -q pending ; do sleep 30 ; done

euca-register \
    --name test_di \
    --description test_of_debian_installer \
    --snapshot $TARGET_SNAPSHOT \
    --kernel $PV_KERNEL \
    --architecture x86_64
    --root-device-name /dev/sda1

The script install-debian-installer follows here.

# License: CC0

parted -s /dev/xvdb mklabel msdos mkpart primary 0% 100%
mke2fs -L debian-installer /dev/xvdb1 -F
mount LABEL=debian-installer /mnt/

cd /mnt


wget $BASEURL/initrd.gz $BASEURL/vmlinuz

mkdir -p boot/grub

cat > boot/grub/menu.lst <<__END__
default 0
timeout 3

title  Debian Installer ($DI_VERSION $ARCH)
root   (hd0,0)
kernel /vmlinuz root=LABEL=debian-installer ro console=hvc0 auto=true priority=critical url= DEBIAN_FRONTEND=text
initrd /initrd.gz

sleep 30