Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Installing AWS Command Line Tools Using Ubuntu Packages

See also: Installing AWS Command Line Tools from Amazon Downloads

Here are the steps for installing the AWS command line tools that are currently available as Ubuntu packages. These include:

  • EC2 API tools
  • EC2 AMI tools
  • IAM - Identity and Access Management
  • RDS - Relational Database Service
  • CloudWatch
  • Auto Scaling
  • ElastiCache

Starting with Ubuntu 12.04 LTS Precise, these are also available:

  • CloudFormation
  • ELB - Elastic Load Balancer

Install Packages

Enable the multiverse repository. This can be done through the Ubuntu Update Manager or by editing /etc/apt/sources.list Here are some commands that will enable multiverse on a new installation:

# 12.04 LTS Precise, 11.10 Oneiric
sudo perl -pi.orig -e \
  'next if /-backports/; s/^# (deb .* multiverse)$/$1/' \
  /etc/apt/sources.list

# 10.04 LTS Lucid
sudo perl -pi.orig -e \
  's/^(deb .* universe)$/$1 multiverse/' \
  /etc/apt/sources.list

Enable the awstools PPA and update the apt package index:

sudo apt-add-repository ppa:awstools-dev/awstools
sudo apt-get update

Install available AWS command line tool packages:

sudo apt-get install ec2-api-tools ec2-ami-tools iamcli rdscli moncli ascli elasticache

# Also available on Ubuntu 12.04 LTS Precise
sudo apt-get install aws-cloudformation-cli elbcli

Some of these tools support passing in credentials on the command line, but for regular use, you will want to store the AWS credentials in files.

Set up AWS Credentials

Create a place to store the AWS credentials:

mkdir -m 0700 $HOME/.aws/

Copy your AWS X.509 certificate and private key to this subdirectory. These files will have names that look something like this:

$HOME/.aws/cert-7KX4CVWWQ52YM2SUCIGGHTPDNDZQMVEF.pem
$HOME/.aws/pk-7KX4CVWWQ52YM2SUCIGGHTPDNDZQMVEF.pem

Create the file $HOME/.aws/aws-credential-file.txt with your AWS access key id and secret access key in the following format:

AWSAccessKeyId=YOURACCESSKEYIDHERE
AWSSecretKey=YOURPRIVATEACCESSKEYHERE

Add the following lines to your $HOME/.bashrc file so that the AWS command line tools know where to find the above files:

# AWS credentials
export EC2_PRIVATE_KEY=$(echo $HOME/.aws/pk-*.pem)
export EC2_CERT=$(echo $HOME/.aws/cert-*.pem)
export AWS_CREDENTIAL_FILE=$HOME/.aws/aws-credential-file.txt

Make sure these are set in your current shell(s):

source $HOME/.bashrc

Test

Make sure that the command line tools are installed and have credentials set up correctly. These commands should not return errors:

ec2-describe-regions 
ec2-ami-tools-version
iam-accountgetsummary
rds-describe-db-engine-versions
mon-version
as-version

# Ubuntu 12.04 LTS Precise and higher
cfn-list-stacks
elb-describe-lb-policies

AWS Command Line Tools

The table below shows some of the various AWS products, whether Amazon publishes command line tools, and whether these are available in key Ubuntu releases. Some of the packages are available in the standard apt repositories, some require adding multiverse, and some are published in the awstools PPA. The awstools PPA also has newer versions of some of the packages released by Amazon after the official Ubuntu release.

<tr>
  <td><a href="http://aws.amazon.com/ec2/">EC2 API Tools</a></td>
  <td><a href="http://aws.amazon.com/developertools/351">AWS CLI</a></td>
  <td>multiverse</td>
  <td>multiverse<br/>PPA&nbsp;updates</td>
  <td>multiverse<br/>PPA&nbsp;updates</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/ec2/">EC2 AMI Tools</a></td>
  <td><a href="http://aws.amazon.com/developertools/368">AWS CLI</a></td>
  <td>multiverse</td>
  <td>multiverse<br/>PPA&nbsp;updates</td>
  <td>multiverse<br/>PPA&nbsp;updates</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/iam/">IAM - Identity and Access Management</a></td>
  <td><a href="http://aws.amazon.com/developertools/AWS-Identity-and-Access-Management/4143">AWS CLI</a></td>
  <td>main</td>
  <td>main</td>
  <td>PPA</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/rds/">RDS - Relational Database Service</a></td>
  <td><a href="http://aws.amazon.com/developertools/2928">AWS CLI</a></td>
  <td>main</td>
  <td>main</td>
  <td>PPA</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/cloudwatch/">CloudWatch</a></td>
  <td><a href="http://aws.amazon.com/developertools/2534">AWS CLI</a></td>
  <td>PPA</td>
  <td>PPA</td>
  <td>PPA</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/autoscaling/">Auto Scaling</a></td>
  <td><a href="http://aws.amazon.com/developertools/2535">AWS CLI</a></td>
  <td>PPA</td>
  <td>PPA</td>
  <td>PPA</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/elasticache/">ElastiCache</a></td>
  <td><a href="http://aws.amazon.com/developertools/Amazon-ElastiCache/2310261897259567">AWS CLI</a></td>
  <td>PPA</td>
  <td>PPA</td>
  <td>PPA</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/elasticloadbalancing/">ELB - Elastic Load Balancing</a></td>
  <td><a href="http://aws.amazon.com/developertools/2536">AWS CLI</a></td>
  <td>PPA</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/cloudformation/">AWS CloudFormation</a></td>
  <td><a href="http://aws.amazon.com/developertools/AWS-CloudFormation/2555753788650372">AWS CLI</a></td>
  <td>PPA</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/importexport/">AWS Import/Export</a></td>
  <td><a href="http://aws.amazon.com/importexport/tools/">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/cloudfront/">CloudFront</a></td>
  <td><a href="http://aws.amazon.com/code/CloudFront">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/cloudsearch/">CloudSearch</a></td>
  <td><a href="http://aws.amazon.com/developertools/9054800585729911">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/elasticbeanstalk/">Elastic Beanstalk</a></td>
  <td><a href="http://aws.amazon.com/code/6752709412171743">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/sns/">SNS - Simple Notification Service</a></td>
  <td><a href="http://aws.amazon.com/developertools/3688">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/elasticmapreduce/">EMR - Elastic MapReduce</a></td>
  <td><a href="http://aws.amazon.com/developertools/Elastic-MapReduce/2264">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/route53/">Route 53</a></td>
  <td><a href="http://aws.amazon.com/code/Amazon-Route-53/">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/s3/">S3 - Simple Storage Service</a></td>
  <td><a href="http://aws.amazon.com/code/128">AWS CLI</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/ses/">SES - Simple Email Service</a></td>
  <td></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/directconnect/">Direct Connect</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/dynamodb/">DynamoDB</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/simpledb/">SimpleDB</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/sqs/">SQS - Simple Queue Service</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/storagegateway/">Storage Gateway</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/swf/">SWF (Simple Workflow Service)</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>

<tr>
  <td><a href="http://aws.amazon.com/vpc/">VPC (Virtual Private Cloud)</a></td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
  <td>-</td>
</tr>
AWS Service Amazon Command Line Tools Ubuntu 12.04 LTS Precise Ubuntu 11.10 Oneiric Ubuntu 10.04 LTS Lucid

As you can see, there are a number of command line tools that are not (yet) packaged in Ubuntu. These can be downloaded directly from Amazon and installed manually.

There are also a number of AWS services that do not have command line tools available from Amazon, though some third parties have provided helpful alternatives.

[Update 2012-09-03: Added links to command line tools for S3, SNS]
[Update 2013-03-10: Added CloudWatch, Auto Scaling, ElastiCache]