Cyberithub

How to Install AWS CLI in Linux (RHEL/CentOS 7/8) Using 6 Easy Steps

In this article, I will take you through the steps to Install AWS CLI in Linux (RHEL/CentOS 7/8) Using 6 Easy Steps. If you are a beginner or professional in AWS Cloud then you might be aware of using Cloud Infrastructure and resources through Management Console. There is another way through which you can access AWS Resources i.e by using AWS CLI command Line tool.

It is very easy to install and use AWS command line resources particularly if you are planning to manage the resources through some script. It can easily be integrated with Bash and other Linux/Unix based Scripting tool and can be used in a very efficient way. In this article, I will show you how you can install AWS CLI in very easy steps.

How to Install AWS CLI in Linux (RHEL/CentOS 7/8) Using 6 Easy Steps 1

Install AWS CLI in Linux (RHEL/CentOS 7/8)

Also Read: Best Steps for s3cmd configuration in Linux (CentOS/RedHat 7)

Step 1: Prerequisites

a)You need to have a running RHEL/CentOS 7/8 System.

b)You need to have yum installed in your system. You can check Top 22 YUM Command Examples in RedHat /CentOS 7 to know more about yum command.

c)You should have sudo access to run all the privilege commands. You can check How to add User to Sudoers to know more about providing sudo access to the User.

Step 2: Update Your System

Before installing AWS CLI tool it is always recommended to update your system with the latest version as sometimes installing a package requires libraries and other dependent packages to be updated. Usually you will see yum installed in all RHEL/CentOS based systems by default so that you don’t have to install it separately. You can easily update your system by launching yum update -y command as shown below.

[root@localhost ~]# 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

.....................................................................................................................................................................................................................

Step 3: Install AWS CLI

Once system is updated, then you can install AWS CLI by using yum install awscli -y command as shown below. This command will automatically find all the dependencies required to install AWS CLI and will install it for us.

[root@localhost ~]# 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

...........................................................................................................................................................................................................

Step 4: Check AWS CLI version

After completed the AWS CLI installation, you can check the aws command version using aws --version command as you can see below. As shown in the below output, aws cli installed version is 1.14.8.

[root@localhost ~]# 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

Step 5: Configure AWS CLI

Now we can go ahead and configure aws command line to access the AWS Resources. You can configure it by using aws configure command as shown below. Here you need to provide AWS Access Key ID, AWS Secret Access Key and Default Region Name. Once you provide all the details you can see a hidden directory .aws created on User home directory which contains two files – Credentials and Config. You can find the aws secret key and aws access key in credential file and default region in config file.

[root@localhost ~]# 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]:

Step 6: Test 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.

[root@localhost ~]# 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

 

 

 

Recommended Posts:-

Understanding Kafka Console Producer and Consumer in 10 Easy Steps

Popular firewalld examples to open a port on RedHat/CentOS 7

8 Most Popular mkdir command in Linux with Examples

26 Useful Firewall CMD Examples on RedHat/CentOS 7

Using 3 Steps – How to create an IAM User and attach policy in AWS

10 Best s3cmd Command Examples for AWS Cloud Administrators

Popular Apache Kafka Architecture Explained Using 4 Basic Components

5 Easy Steps to recover LVM2 Partition , PV , VG , LVM metadata in Linux

For Beginners: Create an EC2 Instance in AWS with 7 Easy Steps

Install AWS CLI – AWS Command Line Interface

Install AWS CLI Version 2 – AWS Command Line Interface

Leave a Comment