How to Install & Configure AWS CLI command line tool

AWS CLI Prerequisites

  • Python 2 version 2.6.5+ or Python 3 version 3.3+
  • Windows, Linux, macOS, or Unix

# If you don't have pip, check to see which version of Python is installed.
$ python --version
$ python3 --version

# Run pip --version to see if your version of Linux already includes Python and pip.
$ pip --version

Install AWS CLI in Ubuntu


#Install in Linux ubuntu
$ sudo apt-get install python-pip
$ sudo pip install awscli
#Verify that the AWS CLI installed correctly by running aws --version.
$ aws --version
$ aws help

Install AWS CLI in RHEL/CENTOS


$ sudo yum -y update
$ sudo yum install wget -y
$ wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
$ yum install epel-release-latest-7.noarch.rpm
$ sudo yum -y install python-pip
$ sudo pip install awscli
#Verify that the AWS CLI installed correctly by running aws --version.
$ aws --version
$ aws help
OR
$ curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"
$ python get-pip.py
$ sudo pip install awscli
#Verify that the AWS CLI installed correctly by running aws --version.
$ aws --version
$ aws help

Install AWS CLI in Mac


$ sudo easy_install pip
$ sudo -H pip install awscli --ignore-installed six
$ sudo -H pip install aws-shell --ignore-installed six
#Verify that the AWS CLI installed correctly by running aws --version.
$ aws --version
$ aws help

Install AWS CLI in Windows

Install AWS CLI in standalone version


#install standalone version
$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
$ unzip awscli-bundle.zip
$ ./awscli-bundle/install -b ~/bin/aws
#Verify that the AWS CLI installed correctly by running aws --version.
$ aws --version
$ aws help

Install AWS CLI Command completion

On Unix-like systems, the AWS CLI includes a command-completion feature that enables you to use the TAB key to complete a partially typed command. This feature is not automatically installed so you need to configure it manually. Configuring command completion requires two pieces of information: the name of the shell you are using and the location of the aws_completer script.

# Locate the AWS Completer
$ which aws_completer

# If all else fails, you can use find to search your entire file system for the AWS completer.
$ find / -name aws_completer

# enable AWS completer
$ complete -C '/usr/local/bin/aws_completer' aws

# Test Command Completion
$ aws sTAB
s3              ses             sqs             sts             swf
s3api           sns             storagegateway  support

Install & Configure AWS Shell

The AWS shell was released in 2015 to interactive productivity booster for the AWS CLI. The current list of key features include:

  • Auto-completion of commands and options
  • Auto-completion of resource identifiers (Amazon EC2 instance IDs, Amazon SQS queue URLs, Amazon SNS topic names, etc.)
  • In-line documentation for commands and options
  • Ability to execute regular shell commands without exiting
  • Exporting executed commands to a text editor

# The aws-shell requires python and pip to install. You can install the aws-shell using pip:
$ pip install aws-shell

# AWS Shell Configure
$ aws-shell
aws> configure
AWS Access Key ID [None]: your-access-key-id
AWS Secret Access Key [None]: your-secret-access-key
Default region name [None]: region-to-use (e.g us-west-2, us-west-1, etc).
Default output format [None]:
aws>