How to Install AWS CLI in Ubuntu

AWS CLI (Amazon web services command line interface) is a command line tool that allows you to manage all your AWS services using command line. It directly connects to AWS API and allows you to execute commands. It is also a great tool to setup automated scripts for AWS. In this article, we will look at multiple ways to install AWS CLI in Ubuntu.


How to Install AWS CLI in Ubuntu

You can install AWS CLI using APT package manager, or using python’s pip package manager.

Also read : How to tar a file in Linux


Using APT Package Manager

In this case we will install the AWS CLI package from apt manager.


1. Update Ubuntu

Open terminal and run the following command.

$ sudo apt-get update


2. Install AWS CLI

Run the following command to install AWS command line interface tool. Press ‘Y’ in case you see any prompts.

$ sudo apt-get install awscli


3. Run AWS CLI

Run the aws command to check its version.

$ sudo aws --version

Similarly, you can run the aws command to configure awscli.

$ sudo aws configure

Also read : How to Upgrade PHP Version in Ubuntu


Install AWS CLI using python pip

The advantage of installing awscli python package is that you can access it from within python scripts, making it easy to automate your aws tasks.


1. Install pip

Open terminal and run the following command to install pip package manager.

## for python 2.x
$ sudo apt-get install python-pip

## for python 3.x
$ sudo apt-get install python3-pip

Also read : How to List all services in systemctl


2. Install AWS CLI

Run the following command to install AWS CLI via pip.

## for python 2.x
$ sudo pip install awscli --upgrade --user

## for python 3.x
$ sudo pip3 install awscli --upgrade --user

Also read : How to Configure FTP Server in Ubuntu


3. Run AWS CLI

In this case you will need to run AWS CLI as a python script

## for python 2.x
$ sudo python -m awscli --version

## for python 3.x
$ sudo python3 -m awscli --version

That’s it. As you can see it is very easy to install AWS CLI in Ubuntu.