The Amazon EC2 AMI Tools are used for the creation of instance-store backed AMIs, the rest of the Amazon EC2 functionality is covered by the Amazon EC2 API Tools. This article covers how to install the Amazon EC2 AMI Tools.

The Amazon EC2 AMI Tools require the following to be installed:

  • curl
  • gzip
  • mkfifo
  • openssl
  • rsync
  • Ruby 1.8.2 or later
  • tee

And the following environment variables to be set:

If the Amazon EC2 API Tools are not installed or if they are in the same directory as the Amazon EC2 AMI Tools, the EC2_HOME environment variable can be used. If both the Amazon EC2 API Tools and the Amazon EC2 AMI Tools are installed and are in different directories, then EC2_HOME should be used for the Amazon EC2 API Tools and EC2_AMITOOL_HOME should be used for the Amazon EC2 AMI Tools.

Install Script

If you’re running Linux, this script will do everything this article covers: install_ec2-ami-tools.sh from our aws_scripts collection. Be sure to run it as root or use sudo.

Git Repository

Checkout the repository. This only needs to be done once throughout this series of articles.

Console - user@hostname ~ $

1
git clone https://bitbucket.org/dowdandassociates/aws_scripts.git

Run install script

Console - user@hostname ~ $

1
sudo aws_scripts/install_aws_cli/install_ec2-ami-tools.sh

Direct Download of Script

Console - user@hostname ~ $

1
curl -L https://bitbucket.org/dowdandassociates/aws_scripts/raw/master/install_aws_cli/install_ec2-ami-tools.sh | sudo bash

Install Process

Create the directory in which to download the software if it does not already exist.

Console - root@hostname ~ #

1
mkdir -p /tmp/aws

Create the directory in which to install the software if it does not already exist.

Console - root@hostname ~ #

1
mkdir -p /opt/aws

Download the software.

Console - root@hostname ~ #

1
2
3
curl --silent \
--output /tmp/aws/ec2-ami-tools.zip \
http://s3.amazonaws.com/ec2-downloads/ec2-ami-tools.zip

Delete any previous unzips of the software that may exist.

Console - root@hostname ~ #

1
rm -fR /tmp/aws/ec2-ami-tools-*

Unzip the software.

Console - root@hostname ~ #

1
unzip -d /tmp/aws /tmp/aws/ec2-ami-tools.zip

Delete any previously installed versions.

Console - root@hostname ~ #

1
rm -fR /opt/aws/ec2-ami-tools

Move the unzipped directory into the install directory.

Console - root@hostname ~ #

1
mv /tmp/aws/ec2-ami-tools-* /opt/aws/ec2-ami-tools

Delete the .zip file.

Console - root@hostname ~ #

1
rm -f /tmp/aws/ec2-ami-tools.zip

Set EC2_AMITOOL_HOME, and put the tools into the path.

Console - root@hostname ~ #

1
2
3
4
cat <<'EOF'>/etc/profile.d/ec2-ami-tools.sh
export EC2_AMITOOL_HOME=/opt/ec2-ami-tools
export PATH=$PATH:$EC2_AMITOOL_HOME/bin
EOF

References

Parts in this series

Comments