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.
Recent comments