Thursday, October 10, 2013

How to set up AWS Command Line Interface on Windows/Ubuntu

*This guide assumes you already have JAVA correctly setup on your machine.
For instructions on how to setup JAVA, check out: Installing and Configuring JAVA

Now, we're going to use pip to install the AWS Command Line Interface to your machines. So if you don't already have pip, you need to install it as follows:

For Ubuntu:
sudo apt-get install python-pip python-dev build-essential
sudo pip install --upgrade pip

For Windows:
Follow the steps here:
I've repeated them below:
First install setuptools:
Then install pip

Quoting the above link,
For me, this installed Pip at C:\Python27\Scripts\pip.exe. Add your analogue of C:\Python27\Scripts to your path (Start / Edit environment variables). Now you should be able to run pip from the command line

Now simply fire up a terminal/command prompt and type:
~$: pip install awscli

After this, open a new terminal/command-prompt and type:
~$: aws
This should be recognized as a command and you should get an error like:
usage: aws [options] <command> <subcommand> [parameters] 
aws: error: too few arguments

This indicates a successful installation.

Now you need to configure awscli with your AWS credentials.
To do this create a file named config (no extension) with the following contents:
[default]aws_access_key_id = AKIAIOSODNN7EXAMPLEaws_secret_access_key = <redacted>region = us-east-1
You can access your aws_access_key_id and aws_secret_access_key at

Now we need to place this file in the appropriate location.
For Ubuntu:
Create and place the file in ~/.aws/

For Windows:
Create and place the file in C:\Users\USERNAME\.aws\

You should be done now.

To test, we'll try downloading files from an S3 bucket.

Create a new empty directory on your machine.
Navigate to that directory from your command line.
Now type:

~$: aws s3 sync s3://bucketname/foldername .
[Don't miss the dot ( . ) at the end]
*This will download all files from the folder in the specified bucket to the current local directory you are at.

That's it.
For a complete list of avaiable commands, check out

Popular Posts