Configuring AWS CLI on Linux

AWS Command Line Interface

 

  • 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.

Installing the AWS Command Line Interface

The primary distribution method for the AWS CLI on Linux, Windows, and macOS is pip, a package manager for Python that provides an easy way to install, upgrade, and remove Python packages and their dependencies.

Current AWS CLI Version

The AWS CLI is updated frequently with support for new services and commands. To see if you have the latest version, see the releases page on GitHub.

Requirements

  • Python 2 version 2.6.5+ or Python 3 version 3.3+
  • Windows, Linux, macOS, or Unix

If you already have pip and a supported version of Python, you can install the AWS CLI with the following command:

$ pip install –upgrade –user awscli

[root@ip-10-0-3-229 /]# pip install –upgrade pip

You are using pip version 6.1.1, however version 9.0.1 is available.

You should consider upgrading via the ‘pip install –upgrade pip’ command.

Collecting pip

Downloading pip-9.0.1-py2.py3-none-any.whl (1.3MB)

100% |████████████████████████████████| 1.3MB 374kB/s

Installing collected packages: pip

Found existing installation: pip 6.1.1

Uninstalling pip-6.1.1:

Successfully uninstalled pip-6.1.1

Successfully installed pip-9.0.1

The –upgrade option tells pip to upgrade any requirements that are already installed. The –user option tells pip to install the program to a subdirectory of your user directory to avoid modifying libraries used by your operating sytem.

Install Python

If your distribution did not come with Python, or came with an older version, install Python before installing pip and the AWS CLI.

Open a command prompt or shell and run the following command to verify that Python installed correctly:

$ python –versionPython 2.7.12

Download the zip file which contains required packages:

Unzip the folder downloaded:

unzip awscli-bundle.zip

 

Navigate to unzipped folder

Install the AWS cli to any destination as per your need

Here we are installing it in /bin so that we don’t have to include later in environment variable:

[root@server awscli-bundle]# ./install -b /bin/awsRunning cmd: /usr/bin/python virtualenv.py –python /usr/bin/python /root/.local/lib/awsRunning cmd: /root/.local/lib/aws/bin/pip install –no-index –find-links file:///root/downloads/awscli-bundle/packages awscli-1.3.6.tar.gzYou can now run: /bin/aws –version

[root@ip-10-0-3-229 packages]# aws –version

aws-cli/1.11.59 Python/2.7.12 Linux/4.4.19-29.55.amzn1.x86_64 botocore/1.5.22

To complete the configuration we need, IAM Access Key ID or Secret Access Key, Which can be downloaded from IAM users-> security credentials

Use the aws configure command to complete it

[root@server scripts]# aws configure

AWS Access Key ID [None]:

AWS Secret Access Key [None]:

Default output format [None]: table

Check the CLI Commands to test it

 

 

 

 

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s