AWS CLI — Installation and Configuration
AWS CLI — Installation and Configuration
www.awstutor.io

AWS CLI

AWS CLI — Installation and Configuration

This post will help you get started with the AWS CLI by creating a new user and configuring the security credentials.

Manish Manalath
Nov 8, 2019 · 4 min read

Amazon Web Services (AWS)is a powerful cloud service platform offering services from web servers to satellite control systems. Millions of organizations from startups to leading government agencies like NASA use AWS to power their data centers.

AWS offers three ways to interact with its services. The web console, the software development kit (SDK) and the command-line interface (CLI). In this article, we will see how you can get started with the AWS CLI.

Creating a New User

Identity and Access Management

In your IAM dashboard, choose ‘Users’ from the menu to your left and click on “Add User”. You should get a prompt from AWS to enter a username along with access types.

New User with Access Types

Provide a username and check “Programmatic access”. If you want the new user account to have web console access as well, check the “AWS Management Console Access” option. But for our initial setup, the latter is not necessary.

Once you click “Next”, you should be presented with the “Permissions” menu. Here you have the option of creating a new group. Groups are a collection of policies while policies define the permissions associated with each AWS resource. Check out this documentation to learn more about groups and policies

Let’s create a new group called AdminGroup and assign the “AdministratorAccess” policy. This will allow the new user account to access all the AWS services via CLI. Providing administrator access to user accounts is not advised unless the user account truly needs admin privileges.

Groups and Policies

After you create the group, skip the tags section and your final review section should look similar to this:

Create User — Review

Click on “Create User”. You should see the screen with the new user created along with the Access Key ID and Secret Access Key. We will need it later.

If you have made it so far, good job!

Install the CLI

$ pip3 install awscli --upgrade --user

This should install AWS CLI on your system. To check the installation, type

$ aws --version

for which you should see something like this

aws-cli/1.16.224 Python/2.7.16 Darwin/19.0.0 botocore/1.12.214

Note: It is highly likely that you will face issues during installation if you are a beginner, so feel free to ask for help in the comments.

Configure security credentials

$ aws configure

The screen will prompt you to enter your security credentials. Go back to the console and get the access key id and secret access key. Choose the region as ‘us-east-1’ (more on this later).

Configuring CLI with security credentials

You won’t receive any output after you configure your security credentials. So let’s check if your security credentials have been configured properly. Type the following command:

$ aws s3 ls

If you don’t get any response, your CLI configuration is successful. If not, you will receive the following error.

An error occurred (InvalidAccessKeyId) when calling the ListBuckets operation: The AWS Access Key Id you provided does not exist in our records.

If you receive this error, double-check your access keys. Also, once you copy your access keys, you will not be shown again. You will have to create new access keys for the user.

If you have successfully installed and configured your AWS CLI, play with some common commands. Let me know the issues you faced (if any) in the comments section.

Summary


Don’t forget to clap if you liked this article. Signup for our weekly newsletter and we will send you a summary of articles every week. No spam. No ads.

AWS Tutor

Articles, How-Tos and Use Cases on AWS Tools and Services

Manish Manalath

Written by

10 years as a Digital Nomad. Writes on Tech (http://awstutor.io) and Productivity. Connect with me on Linkedin (linkedin.com/in/manishmshiva)

AWS Tutor

AWS Tutor

Articles, How-Tos and Use Cases on AWS Tools and Services

More From Medium

More from AWS Tutor

More on AWS from AWS Tutor

More on AWS from AWS Tutor

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade