install aws cli

Install AWS CLI on RHEL CentOS 7/8 Linux Distros

Install AWS CLI on RHEL CentOS 7/8 Linux Distros

This post Install AWS CLI on RHEL/CentOS 7/8 Linux Distros tutorial is a step by step guide to install CLI in Linux distros to control AWS resources. There’s a pressing need to install AWS command line interface in today’s growing use of cloud infrastructure. More on it later let’s get to the basics first. 

Every naïve and pro AWS cloud user understands that we use its management console to control its resources. But there’s one more method to control AWS resources that’s through the AWS CLI command line. If you use a scripting tool like Bash you can easily manage AWS on the command line by integrating it into the Linux/Unix system. 

Let’s start and get done with install AWS CLI in Linux RHEL/CentOS 7/8 tutorial following these steps:

System Requirements

#1 Install RHEL/CentOS 7/8

You need to install RHEL or CentOS 7/8 distros to install AWS Command Line interface as this method will work on these two distros.

Launch/Update YUM

YUM or Yellowdog Updater Modified is an open source command line and graphics package manager tool for RedHat Package Manager used on Linux distros that helps users manage software packages. 

You are supposed to be a super user and need to have exclusive access to sudo for commands to run them and control adding and removing users to Sudoers. 

#2 Update Your System

It’s highly recommended to update the system before installing AWS CLI. Your updated system will have packages and libraries that we might need later on in this tutorial. Regarding YUM, it comes pre-installed in all these RHEL/CentOS. You need to run -y to update it as used here: 

[[email protected] ~]# yum update -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: mirror.xeonbd.com
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package kernel.x86_64 0:3.10.0-1127.10.1.el7 will be installed
---> Package kernel-tools.x86_64 0:3.10.0-1127.8.2.el7 will be updated
---> Package kernel-tools.x86_64 0:3.10.0-1127.10.1.el7 will be an update
---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.8.2.el7 will be updated
---> Package kernel-tools-libs.x86_64 0:3.10.0-1127.10.1.el7 will be an update
---> Package python-perf.x86_64 0:3.10.0-1127.8.2.el7 will be updated
---> Package python-perf.x86_64 0:3.10.0-1127.10.1.el7 will be an update
---> Package unbound-libs.x86_64 0:1.6.6-3.el7 will be updated
---> Package unbound-libs.x86_64 0:1.6.6-4.el7_8 will be an update
--> Finished Dependency Resolution

#3 Install AWS CLI

Have you updated the system? If not then get it done with it quickly. Next we need to install all the dependencies for AWS CLI. We will use YUM for that  by typing yum install  awscli -y to install all that. Use this command:

[[email protected] ~]# yum install awscli -y
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.piconets.webwerks.in
* epel: mirror.xeonbd.com
* extras: mirrors.piconets.webwerks.in
* updates: mirrors.piconets.webwerks.in
Resolving Dependencies
--> Running transaction check
---> Package awscli.noarch 0:1.14.28-5.el7_5.1 will be installed
--> Processing Dependency: python-s3transfer >= 0.1.9 for package: install aws cli-1.14.28-5.el7_5.1.noarch
--> Processing Dependency: python-docutils >= 0.10 for package: install aws cli-1.14.28-5.el7_5.1.noarch
--> Processing Dependency: python-cryptography >= 1.7.2 for package: awscli-1.14.28-5.el7_5.1.noarch
--> Processing Dependency: PyYAML >= 3.10 for package: awscli-1.14.28-5.el7_5.1.noarch
--> Running transaction check
---> Package PyYAML.x86_64 0:3.10-11.el7 will be installed
--> Processing Dependency: libyaml-0.so.2()(64bit) for package: PyYAML-3.10-11.el7.x86_64
---> Package python-docutils.noarch 0:0.11-0.3.20130715svn7687.el7 will be installed
--> Processing Dependency: python-imaging for package: python-docutils-0.11-0.3.20130715svn7687.el7.noarch
---> Package python-s3transfer.noarch 0:0.1.13-1.el7.0.1 will be installed
--> Processing Dependency: python-dateutil >= 1.4 for package: python-s3transfer-0.1.13-1.el7.0.1.noarch
---> Package python2-cryptography.x86_64 0:1.7.2-2.el7 will be installed
--> Processing Dependency: python-pyasn1 >= 0.1.8 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-idna >= 2.0 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-cffi >= 1.4.1 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-setuptools for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Processing Dependency: python-enum34 for package: python2-cryptography-1.7.2-2.el7.x86_64
--> Running transaction check 

#4 Check AWS CLI version

Once AWS CLI is installed we will check aws command version and use aws –version which shows the version of AWS CLI installed on our system:

[[email protected] ~]# aws --version

aws-cli/1.14.28 Python/2.7.5 Linux/3.10.0-1127.8.2.el7.x86_64 botocore/1.8.35

#5 Configure AWS CLI

Next we have to access AWS resources and we will configure aws command line for that as shown below to configure it and add our AWS Access Key ID, AWS Secret Access Key and Default Region. As we have done that the nxt we see a hidden directory .aws created on the User home directory with two files – Credentials and Config. The Credential file has aws secret and access keys while Config file shows our default region. 

[[email protected] ~]# aws configure
AWS Access Key ID [None]: RFIAREPKOP32PU78FSB5
AWS Secret Access Key [None]: Ykloi0EnoZs1sgJOkoSsOesii+utVdiDT+iqsrAw
Default region name [None]: us-east-1
Default output format [None]:

#6 Run AWS CLI command

After configuring the AWS CLI, you can now test the functionality by running a simple aws s3 ls command to list out all the buckets in S3.

We need to test aws cli now that we installed a while ago by using aws s3 Is command for listing all our buckets in S3. See this code snippet here which will appear like this:

[[email protected] ~]# aws s3 ls
2016-08-21 02:54:27 build
2018-07-17 01:49:26 nets-e3ea7edb7ceuytnc29714b9256e21944
2013-03-27 00:43:52 lates-6uwg866yb53aq
2014-12-08 12:19:17 states-9uwgjkhnk53aq
2015-08-22 13:33:46 plates-7uwg86dfc53aq
2015-03-28 05:40:02 temp-5uwjkh87053aq
2013-09-27 05:08:30 ljt1
2014-02-12 03:09:40 customlogs
2014-04-02 07:43:14 elasticbeanstalk-078365300468
2023-04-29 22:22:24 myfile
2013-09-30 03:40:42 cloudtrail
2017-07-12 09:17:12 pro-logs
2016-10-27 21:45:21 debian-files
2015-03-28 05:51:39 selinux-works
2016-12-13 02:00:50 teccess
2016-03-27 00:41:53 testdrive-cft
2018-11-11 02:18:56 test1

That was all about installing AWS CLI (Amazon Web Services Command Line steps that would require few minutes of yours and would help you manage AWS resources and workflow very easily. AWS CLI is a much easier way to manage everything and execute tasks in seconds through it. If you use RHEL or CentOS this is the best way to organize your workflow to increase productivity.

Let’s know in the comments queries, suggestions regarding AWS CLI installation guide.

Install