Installing AWS CLI in Ubuntu

Introduction

The AWS Command Line Interface (CLI) is a unified tool for managing your services in AWS .

With just one tool for downloading and configuring you can manage several AWS services from the command line and automate them with scripts.

AWS CLI v2 offers several new features, including improved installers, new configuration options such as AWS single sign-on (SSO), and various interactive features.

Prerequisites

The following must be installed in advance: curl unzip glibc groff less

Installation AWS CLI 2

I did not have groff so the first thing I did was

sudo apt install groff

Then

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

To install a specific version of AWS CLI, specify it when downloading with a hyphen

For example, to download version 2.0.30

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"

List of versions: github

By default, AWS CLI is installed in

/usr/local/bin/

which aws

/usr/local/bin/aws

You can check the version of the installed AWS CLI with

aws --version

aws-cli/2.1.12 Python/3.7.3 Linux/5.4.0-58-generic exe/x86_64.ubuntu.20 prompt/off

Configuring access

aws configure --profile urn-su-profile

AWS Access Key ID [None]: ABCDEFGHIJKLMNOPQRST
AWS Secret Access Key [None]: ABCDEFGHIJKLMNOPQRST+ABCDEFGHIJ/ABCDEFGH
Default region name [None]: us-east-2
Default output format [None]: json

$ aws s3 ls --profile urn-su-profile

An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.

aws configure list

Name Value Type Location ---- ----- ---- -------- profile <not set> None None access_key ****************XVG6 env secret_key ****************oYRt env region <not set> None None

Article author: Andrei Olegovich

Banner image