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
- You must be able to extract or unpack the downloaded package. If your operating system does not have a built-in command unzip , use an equivalent one.
- AWS CLI version 2 uses glibc, groff and less. They are included by default in most major Linux distributions.
- Amazon supports AWS CLI version 2 on 64-bit versions of the latest distributions CentOS , Fedora, Ubuntu , Amazon Linux 1 and Amazon Linux 2.
- Amazon supports AWS CLI version 2 on Linux ARM.
- Because AWS does not support third-party repositories, they cannot guarantee that they contain the latest version of the AWS command line interface.
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