

Install and Use AWS CLI on Linux - Ubuntu / Debian / CentOS | ComputingForGeeks
source link: https://computingforgeeks.com/how-to-install-and-use-aws-cli-on-linux-ubuntu-debian-centos/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

In this guide I’ll show you two different ways of installing AWS CLI tool on Linux – These will be Ubuntu/Debian, CentOS and Arch Linux line of distributions. The AWS CLI is an open source tool built on top of the AWS SDK for Python (Boto) that provides commands for interacting with AWS services.
With AWS CLI you can easily develop shell scripts to manage your resources on AWS cloud. If you’re more of a developer, you can create programs using AWS SDK.
Install and Use AWS CLI on Linux – Ubuntu / Debian / CentOS Requirements
AWS CLI has the following system requirements:
- Python 2 version 2.6.5+ or Python 3 version 3.3+
- Windows, Linux, macOS, or Unix Operating system
Install AWS CLI on Ubuntu / Debian
You can install AWS CLI using python pip or by using the Bundled Installer for Linux.
Install AWS CLI on Ubuntu / Debian using pip
Install the python-pip
package on your Ubuntu or Debian system:
--- Ubuntu 20.04 ---
sudo apt update
sudo apt -y install python3-pip
--- Other Ubuntu / Debian ---
sudo apt-get update
sudo apt-get -y install python-pip
Upgrade pip to the latest release:
--- Ubuntu 20.04 ---
sudo pip3 install --upgrade pip
--- Other Ubuntu / Debian ---
sudo pip install --upgrade pip
Once the package is installed, install awscli
package with pip:
--- Ubuntu 20.04 ---
sudo pip3 install awscli
--- Other Ubuntu / Debian ---
sudo pip install awscli
To upgrade pip to the latest version, run:
--- Ubuntu 20.04 ---
sudo pip3 install awscli --upgrade
--- Other Ubuntu / Debian ---
sudo pip install awscli --upgrade
Install AWS CLI on CentOS using pip:
CentOS 8:
sudo dnf install -y python3 python3-pip
sudo pip3 install awscli
CentOS 7:
First download and install python-pip
package:
sudo yum -y install python-pip
Upgrade pip to the latest release:
sudo pip install --upgrade pip
Then run the install of awscli from pip:
sudo pip install awscli
To upgrade pip to the latest version, run:
sudo pip install awscli --upgrade
Install AWS CLI on any Linux using Bundled Installer
The Bundled Installer method works on any Linux distribution, the only requirement is Python 2 version 2.6.5+ or Python 3 version 3.3+.
You can check your Python version using
$ python --version
Step 1: Download the AWS CLI Bundled Installer.
This can be done directly from curl
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
Step 2: Unzip the package.
Install unzip package on your Linux distribution:
Ubuntu:
sudo apt-get -y install unzip
CentOS
sudo yum -y install unzip
Arch Linux
sudo pacman -S unzip
Unzip the package using the command
unzip awscli-bundle.zip
Once the package has been unzipped, install it using:
sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Check version installed:
$ /usr/local/bin/aws --version
aws-cli/1.16.143 Python/2.7.5 Linux/3.10.0-957.el7.x86_64 botocore/1.12.133
You can also install the AWS CLI tool without sudo by putting the binary under ~/bin/aws
curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
unzip awscli-bundle.zip
./awscli-bundle/install -b ~/bin/aws
Using AWS CLI on Linux
Before you can start using aws
CLI tool to interact with AWS services, you need to configure it by running the aws configure
command.
$ aws configure
This will ask you to provide
- Your AWS Access Key ID
- AWS Secret Access Key
- Default region name
- Default output format
Sample output is shown below:
AWS Access Key ID [****************M5YB]:
AWS Secret Access Key [****************I5C1]:
Default region name [eu-central-1]:
Default output format [json]:
Once configured, you can start interacting with AWS using aws
command
$ aws s3 ls
2018-08-30 04:40:29 Server-Backups
2018-08-30 06:52:45 ERP-Uploads
I recommend you read AWS CLI reference guide to learn how to use AWS CLI with various services.
AWS Recommended courses:
Other AWS articles available in our blog are:
How to reset / change IAM user password on AWS
How to extend EBS boot disk on AWS without an instance reboot
Create AWS S3 Upload and List Objects Policy without Delete Action
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK