install AWS CLI on Ubuntu 24.04

How To Install AWS CLI On Ubuntu 24.04 Noble Numbat : A Step by Step Guide

In this short article we will show you how to install Amazon Web Services Command Line Interface (AWS CLI) on Ubuntu 24.04 Noble Numbat LTS. The AWS CLI is a versatile tool that can significantly enhance your ability to manage and automate AWS services. By following this guide, you should be able to install, configure, and start using the AWS CLI effectively. Whether you’re managing S3 buckets, EC2 instances, or other AWS services, the AWS CLI provides a powerful interface to streamline your cloud operations.

The AWS Command Line Interface (CLI) is a powerful tool that allows you to interact with Amazon Web Services from your command line. It provides a unified interface for managing AWS services, giving you the ability to automate repetitive tasks, manage resources, and control your cloud infrastructure efficiently.

Installing AWS CLI On Ubuntu 24.04 LTS

AWS CLI can be installed on various operating systems, including Windows, macOS, and Linux. Here’s a brief guide on how to install AWS CLI on Ubuntu 24.04 Linux platforms.. There are three options how to install AWS CLI on Ubuntu system, namely :

  1. Installing AWS CLI using Snap Pakcet Manager
  2. Installing AWS CLI using  Source File
  3. Installing AWS CLI using PIP Installer

1. Installing AWS by Using Snap Packet Manager

The easier way install the packages on Linux is by using snap, where Snap package manager is a secure and reliable way to download, install, update, or remove multiple packages via one-line commands across multiple Linux distributions. On this section, we will use snap packet manager to install AWS CLI on Ubuntu 24.04 LTS. Here’s the steps :

1. Checking  if the snap was installed on the system, by submitting command line :
$ snap --version

Output :

ramansah@bckinfo:~$ snap --version
snap 2.63
snapd 2.63
series 16
ubuntu 24.04
kernel 6.8.0-31-generic
2. Install AWS CLI via Snap

We noticed, if the snap was already installed on the system. Then we will install AWS CLI on the system by submitting command line :

$ sudo snap install aws-cli --classic

Output :

ramansah@bckinfo:~$ sudo snap install aws-cli --classic
aws-cli (v2/stable) 2.15.57 from Amazon Web Services (aws✓) installed
3. Verify AWS CLI installation

Then we will verify if the AWS CLI has already installed by querying its version.

$ aws --version

Output :

ramansah@bckinfo:~$ aws --version
aws-cli/2.15.57 Python/3.11.8 Linux/6.8.0-31-generic exe/x86_64.ubuntu.24

AWSCLI install via snap

4. Remove AWS CLI via Snap

On this step, then we will remove AWS CLI using snap, by submitting command line :

ramansah@bckinfo:~$ sudo snap remove aws-cli
aws-cli removed

2. Installing AWS CLI by Using Source File

On this stage we will install AWS CLI  with another option :  using source file. By using this option, we will download, extract and make AWS CLI manually. For details steps will be shown below :

## Download AWS CLI Source
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
## Unzip AWS CLI
$ unzip awscliv2.zip
## Install AWS CLI
$ sudo ./install
1. Downloads and installs the AWS CLI version 2

By using curl command line, we will download the AWS CLI version 2 from AWS official website.

ramansah@bckinfo:~$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 57.8M 100 57.8M 0 0 540k 0 0:01:49 0:01:49 --:--:-- 443k
2. Unzip AWS CLI

After AWSC CLI file is already downaloade, then we will unzip it, by using command line below.

ramansah@bckinfo:~$ unzip awscliv2.zip
Archive: awscliv2.zip
creating: aws/
creating: aws/dist/
inflating: aws/THIRD_PARTY_LICENSES 
inflating: aws/install 
inflating: aws/README.md 
creating: aws/dist/awscli/

...

inflating: aws/dist/docutils/parsers/rst/include/README.txt 
inflating: aws/dist/docutils/parsers/rst/include/isobox.txt 
inflating: aws/dist/docutils/parsers/rst/include/isoamso.txt 
inflating: aws/dist/docutils/parsers/rst/include/mmlextra-wide.txt 
inflating: aws/dist/docutils/parsers/rst/include/isogrk3.txt 
inflating: aws/dist/docutils/parsers/rst/include/isogrk1.txt
3. Install AWS CLI

Then we will go inside  to $HOME_DIRECTORY/ASW, then install it by using below command below:

ramansah@bckinfo:~$ cd aws/
ramansah@bckinfo:~/aws$ ls
dist install README.md THIRD_PARTY_LICENSES
ramansah@bckinfo:~/aws$ sudo ./install 
You can now run: /usr/local/bin/aws --version
4. Verify the AWS version

We just submit following command line to query aws version.

ramansah@bckinfo:~/aws$ sudo /usr/local/bin/aws --version
aws-cli/2.15.57 Python/3.11.8 Linux/6.8.0-31-generic exe/x86_64.ubuntu.24

AWSCLI_sourcefile

5. Removing AWS CLI from source file

As this tutorial is to show the installation process, then we will remove the installation by using command line :

ramansah@bckinfo:~/aws$ sudo rm -rf /usr/local/aws
ramansah@bckinfo:~/aws$ sudo rm -rf /usr/local/bin/aws
ramansah@bckinfo:~/aws$ aws --version
bash: /usr/local/bin/aws: No such file or directory

3. Installing AWS CLI using PIP Installer

The third option to install AWS CLI is using PIP installer. By default,  Python has already provided a  PIP installer which is useful for downloading and installing various packages. Such packages are not found inside the standard Python library.

1. Install Python PIP

Before installing Python PIP on the system, firstly we will verify if Python3 has already installed on the system. For this purpose we will submit following command line :

##Checking if Python3 has already installed on the system
$ python3
$ python3 --version
## Install Python PIP on the system
$ sudo apt-get install python3-pip

Output :

ramansah@bckinfo:~/aws$ python3
Python 3.12.3 (main, Apr 10 2024, 05:33:47) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
ramansah@bckinfo:~/aws$ python3 --version
Python 3.12.3
ramansah@bckinfo:~/aws$ python3 --version
Python 3.12.3
amansah@bckinfo:~/aws$ sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu build-essential bzip2 dpkg-dev fakeroot g++ g++-13
g++-13-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-13 gcc-13-x86-64-linux-gnu gcc-x86-64-linux-gnu
javascript-common libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan8 libbinutils
libcc1-0 libctf-nobfd0 libctf0 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-13-dev
libgprofng0 libhwasan0 libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore liblsan0 libpython3-dev
libpython3.12-dev libquadmath0 libsframe1 libstdc++-13-dev libtsan2 libubsan1 lto-disabled-list make python3-dev
python3-setuptools python3-wheel python3.12-dev zlib1g-dev
Suggested packages:
binutils-doc gprofng-gui bzip2-doc debian-keyring g++-multilib g++-13-multilib gcc-13-doc gcc-multilib autoconf
automake libtool flex bison gcc-doc gcc-13-multilib gcc-13-locales gdb-x86-64-linux-gnu apache2 | lighttpd
| httpd git bzr libstdc++-13-doc make-doc python-setuptools-doc
The following NEW packages will be installed:
binutils binutils-common binutils-x86-64-linux-gnu build-essential bzip2 dpkg-dev fakeroot g++ g++-13
g++-13-x86-64-linux-gnu g++-x86-64-linux-gnu gcc gcc-13 gcc-13-x86-64-linux-gnu gcc-x86-64-linux-gnu
javascript-common libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan8 libbinutils
libcc1-0 libctf-nobfd0 libctf0 libdpkg-perl libexpat1-dev libfakeroot libfile-fcntllock-perl libgcc-13-dev
libgprofng0 libhwasan0 libitm1 libjs-jquery libjs-sphinxdoc libjs-underscore liblsan0 libpython3-dev
libpython3.12-dev libquadmath0 libsframe1 libstdc++-13-dev libtsan2 libubsan1 lto-disabled-list make python3-dev
python3-pip python3-setuptools python3-wheel python3.12-dev zlib1g-dev
0 upgraded, 51 newly installed, 0 to remove and 17 not upgraded.
Need to get 23.9 MB/65.8 MB of archives.
After this operation, 252 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://id.archive.ubuntu.com/ubuntu noble/main amd64 g++-13-x86-64-linux-gnu amd64 13.2.0-23ubuntu4 [12.5 MB]
Get:2 http://id.archive.ubuntu.com/ubuntu noble/main amd64 g++-13 amd64 13.2.0-23ubuntu4 [14.5 kB] 
. . .
 Setting up g++ (4:13.2.0-7ubuntu1) ...
update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode
Setting up build-essential (12.10ubuntu1) ...
Processing triggers for man-db (2.12.0-4build2) ...
Processing triggers for libc-bin (2.39-0ubuntu8.1) ...
2.  Install AWS CLI Using Python3 PIP

After all are set, then we will submit following command line to install AWS CLI using Python PIP.

$ pip3 install awscli --break-system-packages

Output :

ramansah@bckinfo:~/aws$ pip3 install awscli --break-system-packages
Defaulting to user installation because normal site-packages is not writeable
Collecting awscli
Downloading awscli-1.32.112-py3-none-any.whl.metadata (11 kB)
Collecting botocore==1.34.112 (from awscli)
Downloading botocore-1.34.112-py3-none-any.whl.metadata (5.7 kB)
Collecting docutils<0.17,>=0.10 (from awscli)
Downloading docutils-0.16-py2.py3-none-any.whl.metadata (2.7 kB)
Collecting s3transfer<0.11.0,>=0.10.0 (from awscli)
Downloading s3transfer-0.10.1-py3-none-any.whl.metadata (1.7 kB)
Requirement already satisfied: PyYAML<6.1,>=3.10 in /usr/lib/python3/dist-packages (from awscli) (6.0.1)
Requirement already satisfied: colorama<0.4.7,>=0.2.5 in /usr/lib/python3/dist-packages (from awscli) (0.4.6)
Collecting rsa<4.8,>=3.1.2 (from awscli)
Downloading rsa-4.7.2-py3-none-any.whl.metadata (3.6 kB)
Collecting jmespath<2.0.0,>=0.7.1 (from botocore==1.34.112->awscli)
Downloading jmespath-1.0.1-py3-none-any.whl.metadata (7.6 kB)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /usr/lib/python3/dist-packages (from botocore==1.34.112->awscli) (2.8.2)
Requirement already satisfied: urllib3!=2.2.0,<3,>=1.25.4 in /usr/lib/python3/dist-packages (from botocore==1.34.112->awscli) (2.0.7)
Collecting pyasn1>=0.1.3 (from rsa<4.8,>=3.1.2->awscli)
Downloading pyasn1-0.6.0-py2.py3-none-any.whl.metadata (8.3 kB)
Downloading awscli-1.32.112-py3-none-any.whl (4.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.5/4.5 MB 171.2 kB/s eta 0:00:00
Downloading botocore-1.34.112-py3-none-any.whl (12.3 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.3/12.3 MB 264.7 kB/s eta 0:00:00
Downloading docutils-0.16-py2.py3-none-any.whl (548 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 548.2/548.2 kB 210.0 kB/s eta 0:00:00
Downloading rsa-4.7.2-py3-none-any.whl (34 kB)
Downloading s3transfer-0.10.1-py3-none-any.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.2/82.2 kB 560.7 kB/s eta 0:00:00
Downloading jmespath-1.0.1-py3-none-any.whl (20 kB)
Downloading pyasn1-0.6.0-py2.py3-none-any.whl (85 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 85.3/85.3 kB 656.1 kB/s eta 0:00:00
Installing collected packages: pyasn1, jmespath, docutils, rsa, botocore, s3transfer, awscli
WARNING: The scripts pyrsa-decrypt, pyrsa-encrypt, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/ramansah/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed awscli-1.32.112 botocore-1.34.112 docutils-0.16 jmespath-1.0.1 pyasn1-0.6.0 rsa-4.7.2 s3transfer-0.10.1
3. Verify ASW CLI Installation

After installation is completed done, then we will verify it by submitting command line :

$ pip show awscli

Output :

ramansah@bckinfo:~/aws$ pip show awscli
Name: awscli
Version: 1.32.112
Summary: Universal Command Line Environment for AWS.
Home-page: http://aws.amazon.com/cli/
Author: Amazon Web Services
Author-email: 
License: Apache License 2.0
Location: /home/ramansah/.local/lib/python3.12/site-packages
Requires: botocore, colorama, docutils, PyYAML, rsa, s3transfer
Required-by:
AWSCLI via PythonPIP
4. Remove AWS CLI Using Python PIP

Since the installation is only a tutorial, then we will uninstall or remove the AWS CLI installation by using command line :

$ pip3 uninstall awscli --break-system-packages

Output :

ramansah@bckinfo:~/aws$ pip3 uninstall awscli --break-system-packages
Found existing installation: awscli 1.32.112
Uninstalling awscli-1.32.112:
Would remove:
/home/ramansah/.local/bin/aws
/home/ramansah/.local/bin/aws.cmd
/home/ramansah/.local/bin/aws_bash_completer
/home/ramansah/.local/bin/aws_completer
/home/ramansah/.local/bin/aws_zsh_completer.sh
/home/ramansah/.local/lib/python3.12/site-packages/awscli-1.32.112.dist-info/*
/home/ramansah/.local/lib/python3.12/site-packages/awscli/*
Proceed (Y/n)? Y
Successfully uninstalled awscli-1.32.112

Conclusion

AWS CLI is an indispensable tool for anyone managing AWS environments. Its ability to streamline and automate AWS operations makes it a favorite among developers and system administrators. By following the installation steps and best practices outlined in this guide, you can harness the full power of AWS CLI to enhance your cloud management capabilities.

 

 

 

(Visited 126 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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