Install AWS CLI (Amazon Web Services — Command line Interface) on Ubuntu 16.04 Xenial.

Vishal Sharma
3 min readAug 30, 2018

--

AWS is the market leader in cloud services and offering many services to meet customers needs. AWS services can be managed through Web console as well as CLI (command line interface). In this article, we will learn about how can we install AWS CLI on Ubuntu 16.04.

Pre-requisites:

  • Operating system: Ubuntu (16.04 Xenial) —

To check the version of Ubuntu Server, run following command

$ sudo cat /etc/lsb-release
Ubuntu version check
  • Python (version 2.6.5 and above) and PIP (version 8.1.1 and above) —

To check the version of python and pip, run following commands

$ sudo python --version or $ python -V
Python version check
$ sudo pip --version or $ pip -V
pip version check

In case you don’t have python and pip installed on your system please follow these steps:

How to install python and pip on Ubuntu 16.04 Xenial.

Installation:

  • Old way (not recommended)

This is the old way to install AWS CLI and it’s not recommended because you won’t get latest version here.

To install AWS CLI by this approach, run following commands:

$ sudo apt-get update$ sudo apt-get install awscli
apt-get install awscli

To check the version of AWS CLI, run following command:

$ sudo aws --version
aws --version (1)
  • New way ( recommended)

After fulfilling the pre-requisites, we are ready to install AWS CLI by pip

To install awscli, run following command:

$ sudo pip install awscli
pip install awscli

To check the version of AWS CLI, run following command:

$ sudo aws — version
aws --version (2)

Congratulations, we have installed latest version of AWS CLI. Now, you can start using it.

Challenges:

You might get error like these.

$ sudo aws -- version

aws:command not found

You can resolve this error easily by following commands.

$ ~/.local/bin/aws — version
aws --version (3)
$ sudo export PATH=~/.local/bin:$PATH

This command adds a path, ~/.local/bin in this example, to the current PATH variable.

Load the profile into your current session.

$ source ~/.bash_profile (here I assume the you are using BASH as default shell)
  • You also might get groff error as system could not find groff package in the system.
$ sudo aws help

Could not find executable named “groff”

“groff” error

To resolve this, install groff. Run following command to install the package:

$ sudo apt-get install groff

After installation you will be abled to run all aws commands.

You can also follow AWS documentation for AWS CLI installation here.

--

--

Vishal Sharma

IT Enthusiast, Professional, Novice Sportsperson and Fantasist of Better World. @byVishalSharma on Twitter.