November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

How to Install Configure AWS CLI -Linux, OS X, or Unix

How to Install Configure AWS CLI -Linux, OS X, or Unix
AWS CLI (Command Line Interface)

The AWS Command Line Interface is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.

Steps to Install AWS CLI (Linux, OS X, or Unix)

Prerequisites

1)Linux Machine

2) Python above 2.6.5+

Here my machine Details

1)Fedora release 20 (Heisenbug) Linux rmohan 3.16.6-200.fc20.x86_64

2)[root@rmohan ~]# python –version
Python 2.7.5

Download the AWS CLI Bundled Installer

[root@rmohan tmp]# wget https://s3.amazonaws.com/aws-cli/awscli-bundle.zip

–2016-02-10 15:58:20– https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
Resolving s3.amazonaws.com (s3.amazonaws.com)… 54.231.81.252
Connecting to s3.amazonaws.com (s3.amazonaws.com)|54.231.81.252|:443… connected.
HTTP request sent, awaiting response… 200 OK
Length: 6678296 (6.4M) [application/zip]
Saving to: ‘awscli-bundle.zip’

awscli-bundle.zip 100%[========================================================>] 6.37M 122KB/s in 57s

2016-02-10 15:59:18 (114 KB/s) – ‘awscli-bundle.zip’ saved [6678296/6678296]

Unzip the package.

[root@rmohan tmp]# unzip awscli-bundle.zip
Archive: awscli-bundle.zip
inflating: awscli-bundle/install
inflating: awscli-bundle/packages/argparse-1.2.1.tar.gz
inflating: awscli-bundle/packages/awscli-1.10.3.tar.gz
inflating: awscli-bundle/packages/botocore-1.3.25.tar.gz
inflating: awscli-bundle/packages/colorama-0.3.3.tar.gz
inflating: awscli-bundle/packages/docutils-0.12.tar.gz
inflating: awscli-bundle/packages/futures-3.0.4.tar.gz
inflating: awscli-bundle/packages/jmespath-0.9.0.tar.gz
inflating: awscli-bundle/packages/ordereddict-1.1.tar.gz
inflating: awscli-bundle/packages/pyasn1-0.1.9.tar.gz
inflating: awscli-bundle/packages/python-dateutil-2.4.2.tar.gz
inflating: awscli-bundle/packages/rsa-3.3.tar.gz
inflating: awscli-bundle/packages/s3transfer-0.0.1.tar.gz
inflating: awscli-bundle/packages/simplejson-3.3.0.tar.gz
inflating: awscli-bundle/packages/six-1.10.0.tar.gz
inflating: awscli-bundle/packages/virtualenv-13.0.3.tar.gz

Switch the Dir & Install the same.

[root@rmohan tmp]# cd awscli-bundle/

[root@rmohan awscli-bundle]# ll
total 8
-rwxr-xr-x 1 root root 4528 Feb 9 14:57 install
drwxr-xr-x 2 root root 340 Feb 10 16:01 packages

[root@rmohan awscli-bundle]# ./install -i /usr/local/aws -b /usr/local/bin/aws
Running cmd: /bin/python virtualenv.py –python /bin/python /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install –no-index –find-links file:///tmp/awscli-bundle/packages awscli-1.10.3.tar.gz
You can now run: /usr/local/bin/aws –version

Verify the same.

[root@rmohan awscli-bundle]# aws –version
aws-cli/1.10.3 Python/2.7.5 Linux/3.16.6-200.fc20.x86_64 botocore/1.3.25

[rmohan@rmohan ~]$ aws help

To Read Further Make sure AWS IAM in Place.

Now time to Configuring AWS CLI

[rmohan@rmohan ~]$ aws configure
AWS Access Key ID [None]: AKIA***********4OA
AWS Secret Access Key [None]: zdi*******************iZG2oej
Default region name [None]: ap-southeast-1a
Default output format [None]: json

After this when i test it through me below error.

[rmohan@rmohan ~]$ aws ec2 describe-instances

Could not connect to the endpoint URL: “https://ec2.ap-southeast-1a.amazonaws.com/”

Fix :- region which i configured is wrong. only last with 1 not 1a.

Open following file to fix.

[rmohan@rmohan ~]$ vi .aws/config

[rmohan@rmohan ~]$ aws ec2 describe-instances
{
“Reservations”: []
}

Two IMP Conf file..Just for ref.

[rmohan@rmohan ~]$ cat .aws/config
[default]
output = json
region = ap-southeast-1

[rmohan@rmohan ~]$ cat .aws/credentials
[default]
aws_access_key_id = AKIA***********4OA
aws_secret_access_key = zdi*******************iZG2oejT

[rmohan@rmohan ~]$ aws ec2 create-security-group –group-name rk-sg –description “test security group”
{
“GroupId”: “sg-33777***56”
}

Here you can find screen of GUI as well.

[rmohan@rmohan ~]$ aws ec2 describe-instances –output table –region ap-southeast-1
——————-
|DescribeInstances|
+—————–+
More AWS CLI Command

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>