ec2

Create a EC2 Amazon Machine Image - AMI

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">

Customize an existing AMI image

It's much easier to customize an existing AMI image to your own taste than to start from scratch so let's do that. First we need to find an image that is close to what we want. Read EC2 quickstart on how to setup the EC2 API tools.

$ ec2-describe-images -a 
…
IMAGE   ami-f0f61599    alestic-64/debian-5.0-lenny-base-64-20091011.manifest.xml   063491364108    available   public      x86_64  machine aki-a3d737ca    ari-7cb95a15        instance-store
…

Tags: 

Amazon EC2 Quickstart

< class="field field-name-body field-type-text-with-summary field-label-hidden view-mode-teaser">

EC2 Preparation

First you need to sign up for Amazon's EC2 service and download your X.509 certificate and private key. The certificate and private key files are named as cert-<GUID>.pem and pk-<GUID>.pem

Create a directory to hold your EC2 access credentials.

$ mkdir ~/.ec2
$ mv ~/Downloads/*.pem ~/.ec2

Next download the EC2 API command line tools, add it to your PATH and create a few environment variables.

$ cd ~/bin
$ unzip ~/Downloads/ec2-api-tools.zip
$ ln -s /ec2-api-tools-1.3-46266 ec2
$ export $EC2_HOME=~/bin/ec2
$ export PATH=$EC2_HOME/bin:$PATH
$ export EC2_PRIVATE_KEY=~/.ec2/pk-<guid>.pem 
$ export EC2_CERT=~/.ec2/cert-<guid>.pem
$ # JAVA_HOME is needed for ec2 tools to work
$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home

Let's list some publicly available Amazone Machine Images (AMI) to verify that the tools are working properly.

$ ec2-describe-images -o amazon
...
IMAGE   ami-a21affcb    ec2-public-images/fedora-core-6-x86_64-base-v1.06.manifest.xml  amazon  available   public      x86_64  machine aki-a53adfcc    ari-a23adfcb        instance-store
IMAGE   ami-2d5fba44    ec2-public-images/fedora-core-6-x86_64-base-v1.07.manifest.xml  amazon  available   public      x86_64  machine aki-a53adfcc    ari-a23adfcb        instance-store
IMAGE   ami-225fba4b    ec2-public-images/fedora-core4-apache-mysql-v1.07.manifest.xml  amazon  available   public      i386    machine             instance-store
IMAGE   ami-25b6534c    ec2-public-images/fedora-core4-apache-mysql.manifest.xml    amazon  available   public      i386    machine             instance-store
...

Launch an AMI instance

In order to access an AMI instance via SSH we need to create a EC2 key pair. This can easily be done using the web based AWS management console or following the steps below.

Tags: 

Subscribe to ec2