The AWS CLI client is a tool that makes it easy to work with AWS services using the command line. It allows you automate tasks, create outputs in different formats and much more!

You will find information about downloading, installing, configuring and using the AWS Command Line Interface in this article.

  • To extract the AWS CLI Package, you need to use either a built-in unzip command on your operating system or an equivalent option. Check for the presence of unzip using the following command:

    $ which -a unzip
    /usr/bin/unzip
    /bin/unzip

  • The AWS CLI uses a combination of glibc, groff and less. These software packages are included by default in most major distributions Linux operating systems such as Red Hat, CentOS, Ubuntu, Amazon Linux, etc.

  • The following information is not required to install. However, in order to configure the AWS CLI you should create an IAM account with the proper permissions to access the Amazon service in question. At the completion of this IAM account you will be presented with the below connectivity information that may be used to configure the AWS CLI.

    AWS Access Key ID
    AWS Secret Access Key
    Region name
    Desired output format

 

Installation instructions

Follow these steps from the command line to install the AWS CLI on Linux.

 

Download the installation file to your host

You may download the AWS client using the web Browser of your choice from the following URL:

https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip

Alternatively, you may prefer using the command line utility curl to perform the download. When using curl, we can add the -o option to the command to specify a name for the downloaded package. See the example below.

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

Extract the installer

Once the download has completed we will need to extract the contents. Unzip by default will extract the installer to a locally created folder on your computer named aws under your current location.

Begin the extraction using the following command:

unzip awscliv2.zip

Continue the installation

After the files have been extracted you will need to execute the installation using the following command:

Note: sudo may or may not be required depending on your user account privileges.

sudo ./aws/install

Once the install has completed, you should see a prompt stating “You can now run: /usr/local/bin/aws –version”

At this point the AWS CLI has been installed. However, keep in mind it will still need to be configured.  You may check your AWS CLI version using the following command

aws --version

aws-cli/2.5.3 Python/3.9.11 Linux/4.1.12-124.48.6.el6uek.x86_64 exe/x86_64.oracle.6 prompt/off

Installation completed

Although not configured, you may now search help topics using CLI commands.

For general help use:

aws help

 If you wish to get help with accessing a specific service such as Amazon S3 you could type:

aws s3 help

 

 

 

 

AWS CLI Configuration

 

Begin the configuration process using the aws configure command:

unzip aws configure

 

During configuration of the AWS CLI, you need to provide a few pieces of security information that was provided during setup of your IAM role.
The first is your AWS Access Key ID.

It then asks for AWS Secret Access Key ID that is used to provide authentication when logging into Amazon Web Services via this tool.

The remaining information is optional. You may hit enter on each field to skip or choose to populate them.

Provide your default region name: us-west-2 for example.

Finally Enter the default output format such as json or text

By default this information is stored in the following location ~/.aws/credentials. Please note that if you provide incorrect information you may run configure again to make changes or add profiles using the –profile profilename option

 

Optionally The aws configure import command lets you bring information from .csv files. This can be useful if there are multiple copies of your credentials that need updating or you just want an easy way to update them all at once!
Configuration using a .csv file is beyond the scope of this documentation. Please see the AWS CLI User Guide for more details.

Once the configuration has been completed you are ready to start using the AWS CLI.
You can use the aws configure list command to validate what settings are in place for your account. This will give a report of all available configuration options.

aws configure list