Setup AWS CLI on CentOS 7
Setting up AWS CLI on CentOS 7 is quite straight forward, no need for advanced knowledge or a huge amount of time in order to install this. AWS CLI is a very powerful toolset that helps you to manage all your AWS resources by using the Command Line Interface API calls instead of the well known classic Web Console. AWS CLI can be used and implemented in various projects like Automation, Cost Control, Security Audit etc. giving you the power to manipulate and query all AWS resources in a more granular manner. In this very short tutorial we will guide you as usual, step by step, how to install AWS CLI tools on CentOS 7 server. The entire installation process should take just a few minutes and doesn’t necessarily requires root access, so let’s begin our journey.
Table of contents
Install required packages
Download awscli-bundle
Install AWS CLI on CentOS
Check AWS CLI
Troubleshooting
Install required packages
We will begin our short tutorial about how to install AWS CLI on CentOS 7 by making sure that we have all minimum required packages in place before starting the actual installation of AWS CLI tools (awscli-bundle). For this we will need unzip
, curl
and python
packages installed on our CentOS 7 server, if you have already these packages installed on your server then you may simply skip this particular step but if for some reason this is not present we can simply install unzip
, curl
and python
package as shown in the example below:
$ yum install -y unzip curl python
Download awscli-bundle
Knowing that unzip
, curl
and python
packages are preset on our server we can move forward with our tutorial where we can start downloading and unzipping the awscli-bundle
package provided by AWS. First let’s make sure that we are not downloading the package just anywhere and take a more careful approach by making use of /usr/scr/
folder which has been specifically designed for such things.
$ cd /usr/src/
Now that we are located in the right folder we can start downloading the awscli-bundle
package from the official S3 bucket provided by Amazon using curl
utility like shown in the example below:
$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
Install AWS CLI on CentOS
Now having the bundle provided by AWS present on our server we can unzip it and proceed with installation process as shown below:
$ unzip awscli-bundle.zip
To install awscli
please use the below command on your terminal window, this will take just a few seconds from start to end:
$ ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
If no errors showed up on our terminal then we are safe to say that awscli
has been successfully installed.
Check AWS CLI
We are now done with installation part, let’s check if we can use it:
$ aws --version
A successful output will look similar to this:
aws-cli/1.16.96 Python/2.7.5 Linux/3.10.0-957.1.3.el7.x86_64 botocore/1.12.86
Please note that the output that you may get might be different due aws-cli or Python version but as long you are getting this printed on you terminal console confirms the fact that this has been successfully installed and can be used.
Troubleshooting
If you are prompted that aws
command is not recognised then we may have to symlink the aws
binary like this:
$ ln -s /usr/local/bin/aws /usr/bin/aws
We may safely say now that we are done, we have managed to install AWS CLI on CentOS 7 in just a few simple steps without any issue, this can be later updated via yum
package manager and also via pip
.