DEV Community

Cover image for Install AWS CLI (Command Line Interface) on Ubuntu
Md Abu Musa
Md Abu Musa

Posted on

Install AWS CLI (Command Line Interface) on Ubuntu

To install the AWS CLI (Command Line Interface) on Ubuntu, follow these steps:


1. Update the Package Index

Run the following command to ensure your package list is up-to-date:

sudo apt update
Enter fullscreen mode Exit fullscreen mode

2. Install Dependencies

Ensure you have the necessary dependencies installed:

sudo apt install -y unzip curl
Enter fullscreen mode Exit fullscreen mode

3. Download the AWS CLI Installer

Use curl to download the AWS CLI v2 installer:

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

4. Extract the Installer

Unzip the downloaded file:

unzip awscliv2.zip
Enter fullscreen mode Exit fullscreen mode

5. Run the Installer

Run the installation script:

sudo ./aws/install
Enter fullscreen mode Exit fullscreen mode

6. Verify the Installation

Confirm that the AWS CLI is installed and check its version:

aws --version
Enter fullscreen mode Exit fullscreen mode

You should see output similar to:

aws-cli/2.x.x Python/x.x.x Linux/x.x.x
Enter fullscreen mode Exit fullscreen mode

7. Clean Up

(Optional) Remove the downloaded files to free up space:

rm -rf awscliv2.zip aws
Enter fullscreen mode Exit fullscreen mode

8. Configure the AWS CLI

Set up your AWS credentials:

aws configure
Enter fullscreen mode Exit fullscreen mode

You’ll need to provide:

  • Access Key ID
  • Secret Access Key
  • Default region (e.g., us-east-1)
  • Output format (e.g., json, text, or table)

Top comments (0)