Introduction to AWS Command-Line-Interface (CLI)

Introduction to AWS Command-Line-Interface (CLI)

; Date: April 7, 2018

Tags: Amazon Web Services

The AWS CLI is a tool you install on your laptop making it easier to access Amazon Web Services infrastructure. With the AWS CLI Tool you have command-line access to every AWS service.

AWS CLI is a pip package, and you must already have Python and pip installed.

Installing pip if needed

See: (packaging.python.org) https://packaging.python.org/tutorials/installing-packages/

You may already have it installed, which can be checked as so:

$ pip --version

If this fails you need to install it. If you have Python installed, you may be able to bootstrap pip install this way:

$ python -m ensurepip --default-pip

If that still fails, download (bootstrap.pypa.io) https://bootstrap.pypa.io/get-pip.py and execute

$ python get-pip.py

Installing AWS CLI

For the installation overview, see: (docs.aws.amazon.com) docs.aws.amazon.com cli latest userguide installing.html

$ pip install awscli --upgrade --user

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

OS specific instructions are at:

Configuring credentials so AWS CLI can access your AWS account

Accessing your AWS account with the CLI tool requires getting IAM credentials. You then put those credentials in a hidden file in your home directory.

Head to (aws.amazon.com) https://aws.amazon.com/ to sign up for an AWS account. Next head to https://console.aws.amazon.com/iam/ to create IAM user credentials.

  • In the left-hand pane, click on Users, then Add User
  • Enter a login name, and other settings for this user, when done click on Next: Permissions
  • We’re going to add this user to a Group, so click on Add User to Group and then Create Group
  • Enter a group name. Then using the filtering dropdown, filter the policies by Job Function and select Administrator Access. Click on Create Group.
  • The new group will be shown in a list of groups. Click on Next: Review
  • Look over the settings, and if you agree click on Create User

After that the IAM console will give you a URL like

https://aws-account-number.signin.aws.amazon.com/console/

with which to sign in. Log out of the AWS console, then log-in using this new URL and user name and password you just setup.

Another important task in the IAM console is to set up access keys to the IAM user. Access keys are used for authentication, with the AWS Command-Line tool and other services. While viewing the summary page for an IAM user, click on the Security Credentials tab. On this page is a section labeled Access Keys and a button marked Create Access Key. Click on the button, and a pair of keys will be generated. You must record the keys in a safe place, and this is the only time AWS will ever in, the history of this or any other universe, show you those keys.

For details, see: (docs.aws.amazon.com) docs.aws.amazon.com cli latest userguide cli-chap-getting-started.html

About the Author(s)

David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.

Introduction to AWS Command-Line-Interface (CLI)