1. Install Required Packages

sudo apt update
sudo apt install -y unzip curl

2. Create Installation Directory

mkdir -p ~/.local/aws-cli
cd ~/.local/aws-cli

3. Download AWS CLI

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
ls -l awscliv2.zip  # Verify the download was successful.
unzip awscliv2.zip  # Unzip the downloaded file
ls -l               # Should show a directory named `aws`

4. Install AWS CLI

Run the install script with the --install-dir and --bin-dir options:

./aws/install --install-dir ~/.local/aws-cli --bin-dir ~/.local/bin
  • --install-dir : Specifies where to install AWS CLI

  • --bin-dir : Specifies where to create symlinks to aws and aws_completer

5. Update PATH

Open your shell profile file:

nano ~/.bashrc   # For Bash users
# OR
nano ~/.zshrc    # For Zsh users

Add the following line at the end:

export PATH="$HOME/.local/bin:$PATH"

Save and close the file.

6. Reload Shell Profile

source ~/.bashrc   # For Bash
# OR
source ~/.zshrc    # For Zsh

7. Verify Installation

aws --version

You should see output like:

aws-cli/2.x.x Python/3.x.x Linux/...

8. Configure AWS CLI (Optional)

If you already have AWS credentials:

aws configure

More From Me