OS X install Amazon AWS command-line interface (CLI) tool

How do I setup and install the official Amazon AWS Command Line Interface (cli) on an Apple Mac OS X system?

The official or universal command line interface for Amazon Web Services recommended tool for the AWS. There are various ways to install the AWS CLI.


You must have Python installed on the system. The aws cli package works on Python versions:

  • 2.6.5+
  • 2.7.x+
  • 3.3.x+
  • 3.4.x+

Finding out your Python version

Open the Terminal and type the following command:
$ python --version
$ sw_vers

Sample outputs:

Fig.01: OS X Find Out Python Version

Method #1: Install the aws-cli using brew

Type the following command:
$ brew install awscli
Add the following to ~/.bashrc to enable bash completion for aws command:

 echo 'complete -C aws_completer aws' >> ~/.bashrc

Add the following to ~/.zshrc to enable zsh completion:

 echo 'source /usr/local/share/zsh/site-functions/_aws' >> ~/.zshrc

Method #2: Install the aws-cli using the official Amazon installer

Type the following command:
$ cd /tmp
$ curl -o

  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 6501k  100 6501k    0     0   399k      0  0:00:16  0:00:16 --:--:--  542k

Unzip the file:
$ unzip
Sample outputs:

  inflating: awscli-bundle/install   
  inflating: awscli-bundle/packages/jmespath-0.9.0.tar.gz  
  inflating: awscli-bundle/packages/rsa-3.3.tar.gz  
  inflating: awscli-bundle/packages/simplejson-3.3.0.tar.gz  
  inflating: awscli-bundle/packages/python-dateutil-2.4.2.tar.gz  
  inflating: awscli-bundle/packages/ordereddict-1.1.tar.gz  
  inflating: awscli-bundle/packages/colorama-0.3.3.tar.gz  
  inflating: awscli-bundle/packages/docutils-0.12.tar.gz  
  inflating: awscli-bundle/packages/botocore-1.3.23.tar.gz  
  inflating: awscli-bundle/packages/argparse-1.2.1.tar.gz  
  inflating: awscli-bundle/packages/awscli-1.10.1.tar.gz  
  inflating: awscli-bundle/packages/pyasn1-0.1.9.tar.gz  
  inflating: awscli-bundle/packages/virtualenv-13.0.3.tar.gz  
  inflating: awscli-bundle/packages/six-1.10.0.tar.gz

Install it:
$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Sample outputs:

Running cmd: /usr/local/opt/python/bin/python2.7 --python /usr/local/opt/python/bin/python2.7 /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-index --find-links file:///private/tmp/awscli-bundle/packages awscli-1.10.1.tar.gz
Symlink already exists: /usr/local/bin/aws
Removing symlink.
You can now run: /usr/local/bin/aws --version

How do I use the aws-cli?

You must have an AWS account. Visit

Create the AWS access key ID and secret access key

  1. Visit the IAM console
  2. Select your IAM user name.
  3. Select the Security Credentials tab and then Create Access Key.

Sample outputs:

Fig.02: Get your access key ID and secret access key

To see your access key, choose Show User Security Credentials.
Fig.03: Choose Download Credentials, and store the keys in a secure location

Configure the aws-cli

Type the following command and when prompted enter the AWS Access Key ID and AWS Secret Access Key:
$ aws configure
Sample outputs:

Fig.04: aws configure in action

Now you can use the aws command to control your cloud hosted by the Amazon AWS. The syntax is:
$ aws command
$ aws help
$ aws ec2 help
## examples ##
$ aws ec2 describe-instances --output table
$ aws --region=us-east-1 acm list-certificates
$ aws --region=us-east-1 acm list-certificates --certificate-statuses ISSUED


See Using the AWS Command Line Interface for more information.

Posted by: SXI ADMIN

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....

How to Start and Enable Firewalld on CentOS 7

In this article, we discuss how to start and enable firewalld. It is highly recommended that you have a firewall protecting your server.Pre-Flight CheckThese...