This repository was archived by the owner on Jun 8, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Setup ec2 credentials and tools
soulkiss edited this page Mar 27, 2012
·
7 revisions
First, we put our private key and a certificate on the instance where we will be creating our AMI. We put them in /tmp so they don't hang around after reboots, or get stuck in an image by accident.
INSTANCE_IP=ec2-xxxxxxxxxxx.amazonaws.com
scp /path/to/certs/*{pk,cert}-*.pem ${INSTANCE_IP}:/tmp
Most of the amazon tools check for the EC2_PRIVATE_KEY and the EC2_CERT environment variables, so let's define those on our instance.
export EC2_PRIVATE_KEY=`ls /tmp/*pk-*.pem`
export EC2_CERT=`ls /tmp/*cert-*.pem`
First, the amazon tools need unzip, rsync, java and ruby installed.
apt-get update
apt-get -y upgrade
apt-get install -y unzip openjdk-6-jre ruby libopenssl-ruby rsync
I like to put the amazon api and ami tools in /root/bin, and to make symlinks so that I don't have to keep changing the path.
mkdir -p /root/bin
cd /root/bin
wget http://s3.amazonaws.com/ec2-downloads/ec2-{ami,api}-tools.zip
unzip '*.zip'
rm *.zip
ln -s ec2-ami-tools-* ec2-ami-tools.current
ln -s ec2-api-tools-* ec2-api-tools.current
Now we need to tell our environment where these tools are
cat >>/root/.bashrc <<EOF
export EC2_HOME=/root/bin/ec2-api-tools.current
export EC2_AMITOOL_HOME=/root/bin/ec2-ami-tools.current
export PATH=\${PATH}:\${EC2_HOME}/bin:\${EC2_AMITOOL_HOME}/bin
export JAVA_HOME=/usr
EOF
source /root/.bashrc
You should now be ready to go.