The AWS CLI is for managing your AWS services from a terminal session on your own PC, allowing you to control and script multiple AWS services.

So you’ve got yourself an AWS account and, after a few months, you’re feeling pretty comfortable clicking your way through all the services. But you definitely get the feeling that there may be a little more to this AWS thing than their eye-catching browser console.

aws-cliMaybe it’s time you checked out the AWS CLI (Command Line Interface).  The AWS CLI is a unified tool to manage your AWS services from a terminal session on your own PC. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts. In this article, I will show you how to install the AWS CLI on your Windows PC or on a Linux, Mac, or Unix Operating System.

The more you use the AWS CLI, the more you’ll see how powerful it is. Cloud Academy has a terrific course on the AWS CLI that can guide you through some of the interface’s more sophisticated uses. In any case, here’s how it works:

Install the AWS CLI on Windows

  1. Download the appropriate MSI installer.

    Note

    The 64-bit version of the AWS CLI does not currently work with Windows Server 2008 (version 6.0.6002). Please use the 32-bit installer with this version of Windows.

  2. Run the downloaded MSI installer.
  3. Follow the instructions that appear.

Confirm the installation
To confirm the installation, use the aws --version command at a command prompt (open the START menu and search for “cmd” if you’re not sure how to find the command prompt).

64 Bit
The CLI installs to C:\Program Files\Amazon\AWSCLI

32 Bit
The CLI installs to C:\Program Files (x86)\Amazon\AWSCLI

OK. That was pretty easy. However, we’ve only installed AWS CLI on your PC. To be able to connect to your AWS account, you’ll need one more step.

For Windows, in my opinion, the…

…command is the fastest way to set up your AWS CLI installation.

Through aws configure, the AWS CLI will prompt you for four pieces of information. The AWS Access Key ID and AWS Secret Access Key are your account credentials. Those you will definitely need to provide. You can probably leave the other two – region and output format – as default for the time being.

That should be it. Try out the following command from your cmd prompt and, if you have any s3 buckets, you should see them listed

Install the AWS CLI on Linux, Mac or Unix Operating System

Prerequisites 

  • Linux, OS X, or Unix
  • Python 2.6.3 or later

Check your Python installation:

If your computer doesn’t already have Python installed, or you would like to install a different version of Python, follow the procedure in Install Python.

Follow these steps from the command line to install the AWS CLI

Add your Access Key ID and Secret Access Key to ~/.aws/config using this format:

Protect the config file:

Optionally, you can set an environment variable pointing to the config file. This is especially important if you want to keep it in a non-standard location. For future convenience, also add this line to your ~/.bashrc file:

That should be it. Try out the following from your command prompt and if you have any s3 buckets you should see them listed:

Here is the basic AWS CLI command structure. Keep in mind that any commands you enter in the CLI will have this standard format:

*Parameters can take various types of input values, such as numbers, strings, lists, maps, and JSON structures.

Now what?

So, hopefully, you now have the AWS CLI installed on your PC. What next? Maybe the first thing would be to get a CLI-driven feel for what you have on your S3 account. Here are some suggestions:

List all your users and display the output in a table:

List all your EC2 tags:

Play around with outputs, help, or whatever: