AWC Cli Installation

The AWS Command Line Interface (CLI) 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.

We can install the AWS Command Line Interface (AWS CLI) and its dependencies on most Linux distributions by using the pip package manager or the bundled installer.

Prerequisites

You must have Python 2 version 2.7 or later, or Python 3 version 3.6 or later installed.

Install pip


[root@ip-10-0-1-21 ~]# curl "https://bootstrap.pypa.io/get-pip.py" -o "get-pip.py"


% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                             Dload  Upload   Total   Spent    Left  Speed
100 1764k  100 1764k    0     0  6149k      0 --     --:--:-- 6149k
[root@ip-10-0-1-21 ~]# python get-pip.py
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting pip
  Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
     |████████████████| 1.4 MB 3.0 MB/s
Collecting wheel
  Downloading wheel-0.33.6-py2.py3-none-any.whl (21 kB)
Installing collected packages: pip, wheel
Successfully installed pip-20.0.2 wheel-0.33.6

Install aws cli using pip

[root@ip-10-0-1-21 ~]# pip install awscli
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. 
A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Steps for accessing s3 using aws cli

Prerequisite

Create an IAM user

Create a group and provide s3 full access privileges to the group

Assign user to the group

After creating user it will give you credentials file

Download the credentials file and save it safe

Once you have all prereq and credentials in place , run configure for configure aws cli for you aws account

[root@ip-10-0-1-21 ~]# aws configure
AWS Access Key ID [None]: AKI###############FGP
AWS Secret Access Key [None]: 3/Go+Lo########$$$$$$$$sGBr45YPvu/N60
Default region name [None]:
Default output format [None]:
[root@ip-10-0-1-21 ~]#
[root@ip-10-0-1-21 ~]#
[root@ip-10-0-1-21 ~]# aws configure  list
      Name                    Value             Type    Location
      ----                    -----             ----    --------
     profile                <not set>             None    None
     access_key     ****************KFGP shared-credentials-file
     secret_key     ****************/N60 shared-credentials-file
     region                <not set>             None    None

Check if your cli is working by running list command to check out existing bucket in s3

[root@ip-10-0-1-21 ~]# aws s3 ls
2020-04-04 03:54:00 parwezcognidoc

Make a new bucket in s3 via cli

[root@ip-10-0-1-21 ~]# aws s3 mb s3://cli-test-bckt
 make_bucket: cli-test-bckt
[root@ip-10-0-1-21 ~]#
[root@ip-10-0-1-21 ~]#
[root@ip-10-0-1-21 ~]# aws s3 ls
2020-04-26 04:57:43 cli-test-bckt
2020-04-04 03:54:00 parwezcognidoc

Upload file in bucket

[root@ip-10-0-1-21 ~]# aws s3 cp parwez_vpc.pem s3://cli-test-bckt
upload: ./parwez_vpc.pem to s3://cli-test-bckt/parwez_vpc.pem

 382 total views,  1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *