How to Install and Test AWS CLI on Linux

AWS Command Line Interface (CLI) is a powerful tool that allows you to interact with Amazon Web Services (AWS) through the command line. This guide will walk you through the installation process of AWS CLI on Linux and provide additional commands for testing its functionality.


Before installing AWS CLI, ensure that you have the following:

  • Linux environment (e.g., Ubuntu, CentOS) with administrative privileges.
  • Internet connectivity to download the necessary files.

Installation Steps

  1. Install Unzip First, you need to install the unzip package, which is necessary for extracting the AWS CLI installation files. Open your terminal and execute the following command:

    sudo yum install unzip -y
  2. Download and Install AWS CLI Next, you need to download and install the AWS CLI. Run the following commands in your terminal:

    cd /tmp
    curl "" -o ""
    sudo ./aws/install
  3. Configure AWS CLI After installing AWS CLI, you need to configure it with your AWS account credentials. Use the following command to begin the configuration process:

    aws configure

    This command will prompt you to enter the following information:

    • AWS Access Key ID: Enter your AWS access key ID (provided by AWS).
    • AWS Secret Access Key: Enter your AWS secret access key (provided by AWS).
    • Default region name: Enter the AWS region you want to use (e.g., us-east-1).
    • Default output format: Press Enter to leave it as None or specify a desired output format (e.g., json, text).

    Example configuration:

    AWS Access Key ID [None]: AKIXXXXXX3SINX1X1YK3
    AWS Secret Access Key [None]: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    Default region name [None]: us-east-1
    Default output format [None]:

    Once you have provided the required information, AWS CLI will be configured and ready to use.

Additional Commands

Here are some additional commands you can use to test the functionality of AWS CLI:

List Bucket

aws s3 ls s3://<<bucket-name>>

This command will list the objects (files) present in the specified S3 bucket.

Copy File to Bucket

aws s3 cp <<test-file>> s3://<<bucket-name>>

Use this command to copy a file from your local system to the specified S3 bucket.

Copy File from Bucket

aws s3 cp s3://<<bucket-name>>/<<test-file>> /tmp/<<test-file>>

Use this command to copy a file from the specified S3 bucket to your local system.

Delete File from Bucket

aws s3 rm s3://<<bucket-name>>/<<test-file>>

Use this command to delete a file from the specified S3 bucket.

Feel free to explore and experiment with these commands to interact with AWS services using AWS!