Monthly Archives: October 2016

How to access Amazon Web Services (AWS) via the command line from Linux.

Introduction

 

AWS provide command line tools that are extremely powerful. These tools allow you to administer your AWS account. The tutorial below details how you can connect a Linux machine to your AWS account. There are two portions to this tutorial:

 

  1. Set up your AWS account to allow access from the command line.
  2. Installing the AWS command line tools on your machine and configuring it to access AWS.

Part 1. Setting up AWS to allow access from the command line.

 

Step 1.

 

Log into your AWS account.

 

Step 2.

 

Next click your user name, and in the menu that appears select “Security Credentials”.

 

Step 3.

 

In the screen that appears select “Users”.

Step 4.

 

Next click “Create new users”.

 

Step 5.

 

Give your account a name and insure that you have the check box ticked that states “Generate an access key for each user”. Then click “Create”.

Step 6.

 

In the screen that appears select “Downloads Credentials”. Be sure to take note of where the file saves to as we will need it later.

Step 7.

 

Click back to users and click on the user you have created.

Step 8.

 

Next click “Permissions” and the then “attach policy”.

 

 

Step 9.

 

Select the checkbox besides “Administrator Access” and click “Attach Policy”.

This completes the part of the tutorial that takes place on the AWS console. Next go to your Linux machine and open a terminal.

 

Part 2: Installing and configuring AWS CLI on your Linux machine.

 

We will first need to install PIP which will allow use to install the AWS CLI utility.

 

Step 1.

 

Type the command “curl -O https://bootstrap.pypa.io/get-pip.py” into the termainl

 

Step 2.

 

Next, type “sudo python get-pip.py” and hit the enter key.

 

Step 3.

 

Next run, “pip install awscli”

 

The AWS command line utility should now be installed. Now we need to configure the CLI so we can access our AWS account

 

Step 4.

 

Type “aws configure” into the termainl and press enter. You will now be promoted to enter the following information:

  • AWS Access KEY ID
  • AWS Secret Access Key
  • Default region name
  • Default output format

Enter your details from the CSV file that you saved.

You are now connected to the AWS via the command line!