Downloading and installing the AWS CLI

First, you need to download the AWS CLI. Depending on your operating system, it will require a different method.

Linux / macOS / Unix

Prerequisites:

You must ensure that you have at least Python 2 version 2.6.5+ or Python 3 version 3.3+ installed. To verify your current version, run the command:

python --version

Installation:

The recommendation for installing the AWS CLI is to use the bundled installer provided by AWS. The bundled installer includes all dependencies required for the installation.

1. To begin the installation run the following command:

curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

2. Next, you must unzip the downloaded package from step 1:

unzip awscli-bundle.zip

3. Once the package in unzipped, you can run the installation:

sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

Using the -b option allows all users to use the AWS CLI from any directory, meaning you will not need to specify the install directory in the user’s $PATH variable. 

Windows

Prerequisites:

You must be running Microsoft Windows XP or later.

Installation:

There are three MSI installers to choose from:

1. Select the option required to download the MSI

2. Run the downloaded MSI installer or the CLI setup file, as required

3. Follow the instructions that appear

Once installed, the program files will be stored as shown:

64-bit version

C:\Program Files\Amazon\AWSCLI 

32-bit version

C:\Program Files (x86)\Amazon\AWSCLI

To confirm the installation, use the aws –version command at a command prompt. 

Simple configuration of the AWS CLI

Once you have installed the AWS CLI, you now need to configure the application to be able to connect to your AWS account.  To do so, enter the following from your command prompt:

aws configure

Through aws configure, the AWS CLI will prompt you for four pieces of information. The first two are required. These are your AWS access key ID and AWS secret access key, which serve as your account credentials. You can generate new credentials within AWS Identity and Access Management (IAM) if you do not already have them. The other information you will need is region and output format, which you can leave as default for the time being.

aws configure 
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE 
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY 
Default region name [None]: us-west-2 
Default output format [None]: json

The default region name simply defines the Region where you requests will be sent to. For all available regions, please see the following: Regions and Endpoints

The default output format specifies how the results are formatted. Values that can be used here include: 

  • json 
  • text
  • table

The AWS access key ID and AWS secret access key are used to authenticate your AWS account. This authorizes you to carry out specific tasks and functions as defined by your permissions level.  

The AWS access key ID is made up of 20 random uppercase alphanumeric characters, such as the one displayed on screen.

The AWS secret access key is made up of 40 random upper and lowercase alphanumeric and non-alphanumeric characters as displayed.

These access keys can be created for any IAM user who requires authentication from a programmatic perspective, such as when using the AWS CLI.


IMPORTANT: When the access keys are created, you are prompted to download and save the details. The secret access key ID will only be displayed once, and if you lose it, then you’ll have to delete the associated access key ID and recreate new keys for the user.


It’s worth noting that it’s not possible to retrieve lost secret access key IDs as AWS does not retain copies of these for security reasons in case they were compromised. By associating the access keys with the AWS CLI, it ensures that all API requests made to AWS are signed with a digital signature.

Leave a Comment

MFH IT Solutions (Regd No -LIN : AP-03-46-003-03147775)

Consultation & project support organization.

Contact

MFH IT Solutions (Regd)
NAD Kotha Road, Opp Bashyam School, Butchurajupalem, Jaya Prakash Nagar Visakhapatnam, Andhra Pradesh – 530027