The Amazon Web Services command line interface, or CLI, is a tool that allows you to call AWS services’ public APIs from your command line. This can be useful when developing your own applications or making calls from systems that don’t have a graphical interface. Once you’ve mastered the commands, it can also be much quicker than using the web console.

The CLI is a complex tool, but it’s one you should be familiar with if you want to be truly proficient with the AWS platform. In this guide, the first in a three-part series, we’ll cover the installation process so you can start using it right away.

Installation

Installation of the AWS CLI couldn’t be easier and there are multiple options, depending on your needs or level of expertise.

Before we get started, note that these methods will explain how to install the AWS CLI on Windows, Mac, and Linux. If you’re running the Amazon Linux AMI (on an EC2 instance, for example), the AWS CLI comes pre-installed.

Python and Pip

Supported Operating Systems: Windows (XP or later), Linux, macOS, and Unix

Python and pip are the primary installation and distribution methods for the AWS CLI on all major operating systems. You’ll need to have them installed on your system if you want to follow the instructions in this section.

  1. Install the AWS CLI:pip install awscli --upgrade --user You can also use this command in the future if you need to update the AWS CLI.
  2. Verify that the AWS CLI is installed correctly:aws --version This should return a version number and some other information about the tool.

What are the benefits of using pip?

  • More control over the installation.
  • Guaranteed to have the latest version.
  • Easily update to the newest version by running a single command.
  • Install the AWS CLI in a virtual environment using virtualenv.

MSI Installer

Supported Operating Systems: Windows (XP or later)

  1. Download the MSI Installer corresponding to your OS architecture:
  2. Follow the on-screen instructions.

NOTE: The MSI installer does not work with Windows Server 2008 (version 6.0.6002). You MUST use pip to install with this version.

What are the benefits of using the MSI Installer?

The MSI Installer installs all of the required dependencies as well as the AWS CLI application. It also provides a graphical interface that makes installation relatively simple.

Where is the AWS CLI installed?

By default, the MSI Installer installs the AWS CLI in the C:\Program Files\Amazon\AWSCLI directory on 32-bit systems and in the C:\Program Files (x86)\Amazon\AWSCLI directory on 64-bit systems.

Bundled Installer

Dependencies: Python 2 version 2.6.5+ or Python 3 version 3.3+

Supported Operating Systems: Linux, macOS, and Unix

  1. Download the Bundled Installer:curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
  2. Unzip the archive.
  3. Run the executable:sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

NOTE: By default, the script runs under the system’s default version of Python, which may be lower than the required version. You may need to specify the correct version of Python by using the full path to the binary file.

What are the benefits of using the Bundled Installer?

  • You’re guaranteed to have the latest version of AWS CLI.
  • The Bundled Installer includes the AWS CLI, its dependencies, and a shell script that performs the installation for you.

Where is the AWS CLI installed?

By default, the bundled installer installs the AWS CLI in the ~/.local/lib/aws directory and does not put anything outside of this directory except the optional symlink, which can be created using the -b option. This eliminates the need to specify the install directory in the user’s PATH environment variable.

Can I run the bundled installer without sudo?

Yes! After downloading the installer, run:

./awscli-bundle/install -b my/symlink/path/aws

Then add these two lines to your shell profile (~/.profiles, ~/.bash_profile, etc.):

echo $PATH | grep my/symlink/path

export PATH=my/symlink/path:$PATH

More Information

The AWS CLI is open source and built on top of the AWS SDK for Python. It works by making API calls to the services over HTTPS on port 443, so make sure that port is open for connections. You can even remotely use the AWS CLI on Amazon EC2 using PuTTY, SSH, or the Amazon EC2 systems manager.

Even more information about the AWS CLI can be found in the official user guide.

Common Questions

What are the benefits of using the AWS CLI?

  • Direct access to the AWS services’ public APIs.
  • Use of all the functionality provided by the AWS Management Console.
  • Develop shell scripts to manage resources.
  • Low-level commands for complete control AND higher level commands that simplify using a complex service.

Where do I run commands on Windows (XP or later)?

You can run commands in either PowerShell or the Windows Command Prompt (CMD).

Where do I run commands on Linux, macOS, or Unix?

You can run commands in your terminal application, using any of the common shells such as bash, zsh, and tsch.

Are there any additional tools?

The aws-shell tool is a command line shell program that provides convenience and productivity features such as:

  • Fuzzy auto-completion for commands, options, and resource identifiers
  • Dynamic in-line documentation
  • Execution of system shell commands
  • Exporting executed commands to a text editor

Like the AWS CLI, aws-shell is open source and can be found on Github.

Can I use package managers other than pip?

Absolutely! You can use package managers such as APT (Ubuntu and Debian), yum (CentOS), or the Bundled Installer to install the AWS CLI.

However, pip and the bundled installer are the recommended methods to ensure you get the latest version.

Can I use a virtual environment? What are the benefits?

Of course! By using a virtual environment, you can avoid requirement version conflicts with other pip packages.

How do I install AWS CLI on Windows (XP or later)?

Use pip or the MSI Installer, which includes the AWS CLI and its dependencies.

How do I install AWS CLI on Linux, Mac, or Unix?

Use pip or the Bundled Installer, which includes the AWS CLI, its dependencies, and a shell script that performs the installation for you.

Troubleshooting

  • For any type of AWS CLI installation method, verify that the AWS CLI was installed correctly by running aws –version or which aws. If the executable is not found, add it to your system’s PATH environment variable.
  • You can find information on troubleshooting an AWS CLI installation on Linux here.

Success!

That’s it! All you have to do now is configure the AWS CLI to use your specific AWS account and begin working with services! We’ll go over configuration in an upcoming post! If you want to get started immediately, feel free to check out the documentation and try to set it up on your own.

200+ content launch footer

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get actionable training and tech advice

We'll email you our latest articles up to once per week.