Categories
AWS Bash

Install the latest AWS CLI v2 on Ubuntu, in 2 minutes

To install the latest version of AWS CLI v2 on your Ubuntu machine, open a terminal and run:

cd ~/Downloads
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

To check that everything went well, run:

$ aws --version
aws-cli/2.2.42 Python/3.8.8 Linux/5.4.0-87-generic exe/x86_64.ubuntu.18 prompt/off

We can see that the aws-cli version 2.2.42 is now installed !

If aws –version doesn’t work

If you get this error:

bash: /home/<USER>/.local/bin/aws: No such file or directory

it means you need to create a symbolic link:

ln -s /usr/local/aws-cli/v2/current/bin/aws /home/$USER/.local/bin

Now everything should work !

Uninstall AWS CLI v1 first, if you have it

If you already have AWS CLI v1, uninstall it first bedofore installing AWS CLI v2:

sudo rm -rf /usr/local/aws
sudo rm /usr/local/bin/aws

Configure the CLI with AWS access key ID and AWS secret key

The first thing you will certainly want to do with your new CLI is to setup your key ID and secret. To do this, simply type:

aws configure

and you will be prompted to enter your key ID and secret.

That’s it for this tutorial, thank you for reading ! If you need help, please leave a reply below, we answer within 24 hours.

Leave a Reply

Your email address will not be published. Required fields are marked *