Installing aws-cli on Ubuntu 18.04 LTS

There are a number of ways to install the AWS command line tools. The below method used to be my preferred one for Ubuntu 18.04 LTS.  However a recent update broke my awscli installation using this method.  As such I now prefer the PIP method shown below.

Ubuntu Repository

[andy@ubuntu18 ~]$ sudo apt install awscli

Check that was successful with:

[andy@ubuntu18 ~]$ aws --version
aws-cli/1.14.44 Python/3.6.7 Linux/4.15.0-50-generic botocore/1.8.48

Configure aws-cli to use your AWS credentials:

[andy@centos7 ~]$ aws configure
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: eu-west-1
Default output format [None]: json

You can test your AWS credentials with the below command.

[andy@centos7 ~]$ aws sts get-caller-identity
    "Account": "903503371367",
    "Arn": "arn:aws:iam::903503371367:user/andy"

It should display your users details if you are authenticated.


If using this method, its best to install it into a virtual environment. Follow this guide first if you don’t already have one setup.

First edit ~/.bashrc to include ~/.local/bin on the class path:

[andy@ubuntu18 ~]$ vim ~/.bashrc


export PATH=~/.local/bin:$PATH

Then load in the change:

[andy@ubuntu18 ~]$ source ~/.bashrc

Create a new project called awscli and enter the virtual environment:

[andy@ubuntu18 ~]$ mkproject -p /usr/bin/python3 awscli

Install using pip3:

(awscli) apike@bs:~/Devel/awscli$ sudo pip3 install awscli --upgrade --user

For some reason I also had to issue:

(awscli) apike@bs:~/Devel/awscli$ sudo pip3 install awscli --force-reinstall --upgrade

Check it works with:

(awscli) apike@bs:~/Devel/awscli$ aws --version
aws-cli/1.17.6 Python/3.6.9 Linux/4.15.0-74-generic botocore/1.14.6

Then configure with:

(awscli) apike@bs:~/Devel/awscli$ aws configure

Be the first to comment

Leave a Reply