Set up and Update AWS CLI (awscli) tools on Linux using PIP
Here in this post we will going to again installation of AWS CLI Tool through another method using Pip on Linux based flavour operating system like centos , rhel , fedora etc.AWS CLI tool is inbuilt in Amazon Linux AMI’s already.So if you are using Amazon Linux ami then you need to only update server pakcages after set up EC2 Instance.
Earlier we have installed EC2 API CLI tool which is composed in java and included shell scripts and Here we will using python based command line ec2 tool . Great Performance and large number of services support is available on python based tool instead of java composed tool .
Here we will follow below some steps to set up AWS CLI
(1) Set up and Configure Python
(2) PIP Installation
(3) Install awscli using pip
(4) Set up and configure aws cli tool
(5) Check and Verify
AWS CLI Prerequisites :
Before installation it need soem prerequisites , Find below about requirement.
- Here we are going to install in Linux based system , so it need Linux OS like CentOs , Red Hat ( RHEL ) etc.
- Python version 2.6.5 or more upgraded should be install on server.
- Pip install.
(1) Installation of Python :
Here i have used most latest version of python 3.5.0 . I have already post my article about Installation of Python 3 .
Check Python version through below command.
# python –V
Output Python 3.5.0
(2) Installation of PIP :
For installation of pip download script through below command.
curl -O https://bootstrap.pypa.io/get-pip.py
Run the script to install pip.
# python get-pip.py
OUTPUT : Collecting pip .... Downloading pip-7.1.2-py2.py3-none-any.whl (1.1MB) 100% |████████████████████████████████| 1.1MB 420kB/s Collecting wheel Downloading wheel-0.26.0-py2.py3-none-any.whl (63kB) 100% |████████████████████████████████| 65kB 6.7MB/s Installing collected packages: pip, wheel Successfully installed pip-7.1.2 wheel-0.26.0 .......................
(3) Install AWS CLI using pip :
Now we are going to installa awscli after completing prerequisites requirement through below pip command.
# pip install awscli
OUTPUT : Collecting awscli Downloading awscli-1.8.13-py2.py3-none-any.whl (794kB) ..... 100% |████████████████████████████████| 798kB 592kB/s Collecting botocore==1.2.11 (from awscli) Downloading botocore-1.2.11-py2.py3-none-any.whl (2.1MB) 100% |████████████████████████████████| 2.1MB 226kB/s Collecting rsa<=3.3.0,>=3.1.2 (from awscli) Downloading rsa-3.2-py2.py3-none-any.whl (43kB) 100% |████████████████████████████████| 45kB 8.6MB/s Collecting colorama<=0.3.3,>=0.2.5 (from awscli) Downloading colorama-0.3.3.tar.gz Collecting docutils>=0.10 (from awscli) Downloading docutils-0.12.tar.gz (1.6MB) 100% |████████████████████████████████| 1.6MB 291kB/s Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.2.11->awscli) Downloading jmespath-0.9.0-py2.py3-none-any.whl .... Successfully installed awscli-1.8.13 botocore-1.2.11 colorama-0.3.3 docutils-0.12 jmespath-0.9.0 pyasn1-0.1.9 python-dateutil-2.4.2 rsa-3.2 six-1.10.0
(4) Set up and configure aws cli tool :
Now set up aws for your aws panel details. Run below command and it will prompted to you for every field like aws secret key , aws access key , region etc… Run below command to configure aws cli. You can get Access key ID and Secret Access Key from Security Credententials form AWS.
# aws configure
OUTPUT : aws configure AWS Access Key ID [None]: XXXXXXXXXXXXXXXXXXXX AWS Secret Access Key [None]: XXXXXXXXXXXXXXXXXXXXXXXX Default region name [None]:us-east-1 Default output format [None]: table
Here provide access key and secret access key and region and format of table , I write table format . Your credentials and region and table format details will be save on .aws directory on config and credentials files which on home directory path of user like mine “~/.aws/config” and “~/.aws/credentials” .
# cat ~/.aws/config [default] output = table region = us-east-1 #cat ~/.aws/credentials [default] aws_access_key_id = XXXXXXXXXXXXXXXX aws_secret_access_key =XXXXXXXXXXXXXXXXXXXXXXX
(5) Check and Verify :
Now test for aws cli tool through below command . I have written two command below , you can use any one of them.
# aws ec2 describe-regions
# aws help
How to Upgrade AWS CLI ?
AWS development on tool always in process , they publish newer version of tools on some time interverval , so we need to require upgrade our AWS CLI Tool .
Here is below command to upgrade awscli tool.
pip install --upgrade awscli
awscli is actual library of awscli tool.
Remove or Un install AWS CLI
If you want to uninstall aws cli from server . Run the below steps .
#pip uninstall awscli