Unified AWS Command Line Tool

Long, long ago, in a time almost forgotten, this seemed like a good idea:

AWS CLIs

Over 15 different command line tools, each maintained separately for the various services AWS offered. This was a real pain because they used different languages including Java (Sun, Oracle or openjdk - your guess), Python, Ruby (for EMR, it only worked with Ruby 1.8.7 which has been deprecated by the rest of the world), just to name a few. To add to the pain, they rarely shared configuration files, and each required their own environment variables and a spot on your PATH. PITA.

Now all of that is over. AWS have been working on a unified CLI for some time, and yesterday, they release AWS CLI version 1.0.0. Since the new AWS CLI is written in Python, installing it is as easy as:

sudo pip install awscli

Set your default region in your .bashrc or .profile file:

# AWS
export AWS_DEFAULT_REGION="us-west-2"

(TIP: you can run source ~/.bashrc to add it to the current shell)

Then, create a .boto file in your home directory with your credentials like so:

# Boto (Python AWS Library) config file
[Credentials]
aws_access_key_id = AKAABCDEFGHIJKLMNOP
aws_secret_access_key = bbbbbsecretkeycannotbeguessedbbbbbb

This config file is used by many other AWS tools including our own DistAMI, Backup Monkey and Graffiti Monkey, so there is nothing else to do once you have this file.

Now you can use over 20 AWS services from the command line:

aws ec2 describe-instances

You can always get help incrementally too:

aws help
aws ec2 help
aws ec2 describe-instances help

So ditch all those old CLI tools with a big rm -rf, and enjoy using one powerful tool to do it all.

Wednesday 09/04/2013 at 10:47am | Peter Sankauskas
comments powered by Disqus