Tuesday, December 22, 2015

How To Install and Configure AWS CLI on RHEL 7


Overview

Amazon Web Services Command Line Interface (CLI) is a unified tool to manage your AWS services. You can control multiple AWS services from the command line and automate them through scripts.

In this guide we will navigate through the steps of installation and configuration of AWS CLI interface.

Applies To

Tested on RHEL 7, CentOS 7.

Pre-Requisites

·        Python 2 version 2.6.5+ or Python 3 version 3.3+

Installation

Installation of Amazon CLI is a simple procedure.

Check Packages

rpm -qa | grep python

Download AWS CLI Bundler

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

Unzip bundle

unzip awscli-bundle.zip

Install

./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Parameter
Purpose
-i
Installation directory
-b
Binary Location for AWS CLI

Test Installation Status

/usr/local/bin/aws --version or aws help

Configuring AWS CLI

First step before you configure the AWS CLI, you need to get the “AWS Access Key ID” and “AWS Secret Access Key” from the AWS Management console from the root user “Security Credentials” menu option and click on “Create New Access Key”.

AWS Access Key = Your Account Access Key
AWS Secret Access Key = Your Account Secret Access Key

AWS Portal – Security Credentials

After login into the AWS portal, click on “Security Credentials” option.

Portal – Access Key

Click on option “Access Keys (Access Key ID and Secret Access Key)” and click on “Create New Access Key” button, to generate a new key.

Note: you can also download the access key file.

Portal – Access Key

Click on option “Access Keys (Access Key ID and Secret Access Key)”.

Configure CLI

Once you have generate the access key ID and secret access key, you may configure cli, to configure the cli run the command;

aws configure

CLI Configuration Files

After configuring the AWS CLI, the configuration files are stored in the user’s home directory under “.aws” folder. config file will contain the options set and credentials file will user credentials.

cd ~/; pwd; ll

Run Sample CLI

To demonstrate the cli command execution, we will check for availability zones in text output, run the below command;

aws ec2 describe-availability-zones

Slideshare Information

Step by step guide with screenshot is uploaded.


6 comments:

  1. thanks for the blog,it really helpful.

    ReplyDelete
  2. Hello,

    I've followed your blog & quiet happy, but I am not getting my availability zones using below command. I've configured all ACCESS KEYS Properly.

    aws ec2 describe-availability-zones


    This command mounts data1 bucket on linux local directory "s3data1". But, it mount/unmounts on frequent basis.

    s3fs -o use_cache=/tmp/cache/ data1 /s3data1/

    Any Clues?

    ReplyDelete
    Replies
    1. The problem is resolved. Actually, I removed port 443 to OUTSIDE of Security Group. Once I added it, everything started working smoothly.

      Delete
  3. Thanks for sharing valuable information. Your blogs were helpful to AWS learners. I
    request to update the blog through step-by-step. Also, find the AWS news at
    AWS Online Training

    ReplyDelete