Installing Debian on Amazon EC2

by Martin Monperrus
It is not straightforward to install a Debian server on Amazon EC2. Indeed, Amazon provides as quick start Red Hat Linux, Suse Linux and their own Amazon Linux but not Debian linux.

Fortunately, RightScale provides a very good public AMI image of Debian Squeeze (the latest stable version of Debian).

To install Debian:
- Click on "Launch instance"
- In step "Choose an AMI", select tab "Community AMIs"
- Filter by "debian_6"
- Select the AMI rightimage_debian_6.0.1_amd64_20110405 (In region EU West, the AMI ID is ami-0f01367b in 64 bit and ami-e1013695 in 32 bit)
- Then continue the lauching process with the default options (you should get at some point a private SSH key)

To connect to your machine:
- You have to open the SSH port (22) which is disallowed by default in the EC2 architecture (see http://aws.amazon.com/articles/1145#08)
- ssh -i keyname.pem your_machine.ec2.amazonaws.com


Note:
- You may also allow ICMP packets in order to enable Path MTU discovery
- You may run an aptitude update && aptitude upgrade to update the system (the Righscale image is already configured with the correct Debian mirrors)
- You can safely remove the rightscale package (aptitude remove rightscale) or disable the rightscale stuff (update-rc.d rightscale disable && update-rc.d rightboot disable && update-rc.d rightlink disable)
- This image automatically loads the SSH key from the Amazon servers at boot time, see /etc/rc5.d/S20getsshkey
- This image uses the kernel PVGRUB (ID: aki-41eec435 in EU west)), which is a paravirtual "miniOS" which runs a version of GNU GRUB, the standard Linux boot loader. PVGRUB selects the kernel to boot by reading /boot/grub/menu.lst from your image. In other terms, this image actually launches the default Debian kernel (2.6.32-5-xen-amd64). As a consequence, the block devices are called /dev/xvda1 instead of /dev/sda1 (see Enabling User Provided Kernels in Amazon EC2)

References:
* RightScale OSS
* RightImage Debian 6.0.1 (squeeze) amd64 RL 5.6.28 EBS
* Amazon EC2 Image @ Debian
* EC2 Starters Guide @ Ubuntu
* Amazon EC2 Technical FAQs
* http://mirror.rightscale.com/rightlink/
Tagged as: