DebianDebian Based

How To Install AWS CLI on Debian 13

Install AWS CLI on Debian 13

The AWS Command Line Interface transforms how you interact with Amazon Web Services. Instead of clicking through the AWS Management Console, you can execute commands directly from your terminal, automate repetitive tasks, and integrate cloud operations into your scripts and workflows. For Debian 13 users, installing AWS CLI opens doors to efficient cloud infrastructure management — whether you’re deploying applications, managing S3 storage, or orchestrating EC2 instances.

This comprehensive guide walks you through multiple installation methods for AWS CLI on Debian 13. You’ll learn the recommended installation approach, alternative methods, configuration steps, and troubleshooting techniques. By the end, you’ll have a fully functional AWS CLI setup ready for production use.

Understanding AWS CLI

AWS CLI is a unified command-line tool that provides direct access to AWS services through your terminal. It eliminates the need for constant browser-based console navigation, offering a faster and more scriptable approach to cloud management.

The tool supports hundreds of AWS services. You can manage S3 buckets, launch EC2 instances, configure IAM permissions, deploy Lambda functions, and orchestrate CloudFormation stacks — all from simple commands. AWS CLI version 2, the current standard, brings improved performance, enhanced installers, and better feature support compared to the legacy version 1.

Why use AWS CLI on Debian? Automation stands as the primary advantage. Scripts can execute dozens of operations in seconds. CI/CD pipelines integrate seamlessly with CLI commands. Batch operations that would take hours through the console complete in minutes. Plus, the command-line interface consumes fewer system resources than maintaining multiple browser tabs.

Prerequisites and Requirements

Before installation, verify your system meets these requirements. Debian 13 needs approximately 200 MB of free disk space for AWS CLI and its dependencies. An active internet connection is essential for downloading packages.

Your user account requires sudo or root privileges to install system-wide applications. Most Debian 13 installations include Python 3 by default — confirm with python3 --version. You’ll also need the curl utility for downloading files and unzip for extracting installation packages.

On the AWS side, you must have an active AWS account with access credentials. Navigate to the IAM console and generate an Access Key ID and Secret Access Key. These credentials authenticate your CLI commands against AWS services. Understanding basic IAM concepts helps avoid permission-related issues later.

Method 1: Installing AWS CLI Using the Official Installer (Recommended)

The official AWS CLI installer provides the latest version with complete feature support. This method works reliably across Debian systems and ensures you get AWS CLI version 2.

Step 1: Update System Packages

Start by refreshing your package repository and upgrading existing packages:

sudo apt update && sudo apt upgrade -y

This ensures your system has the latest security patches and prevents conflicts with outdated dependencies. The process takes one to five minutes depending on your system’s update status.

Step 2: Install Required Dependencies

AWS CLI installation requires curl and unzip utilities. Install them with:

sudo apt install curl unzip -y

Curl downloads the installer from AWS servers, while unzip extracts the installation archive. Both tools are lightweight and install quickly.

Step 3: Download AWS CLI v2

Download the latest AWS CLI version 2 installer:

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

This command fetches the installer package — approximately 50–60 MB — and saves it as awscliv2.zip in your current directory. The download completes in seconds with a stable connection. For ARM-based systems, use the ARM-compatible installer URL. Intel and AMD processors use the x86_64 version shown above.

Step 4: Extract the Installation Package

Unzip the downloaded archive:

unzip awscliv2.zip

This creates an aws directory containing the installation script and AWS CLI components. You’ll see extracted files listed in your terminal as the process completes.

Step 5: Run the Installation Script

Execute the installer with sudo privileges:

sudo ./aws/install

The installer places AWS CLI files in /usr/local/aws-cli and creates a symbolic link at /usr/local/bin/aws. This default location makes the aws command accessible system-wide without PATH modifications. Installation typically completes in under 30 seconds.

Step 6: Verify Installation

Confirm AWS CLI installed correctly:

aws --version

You should see output similar to:

aws-cli/2.15.0 Python/3.11.2 Linux/6.1.0-debian-amd64

This displays your AWS CLI version, Python version, and system information. If you receive a “command not found” error, proceed to the troubleshooting section.

Step 7: Clean Up Installation Files

Remove the downloaded archive and extracted directory to recover disk space:

rm -rf awscliv2.zip aws

This recovers approximately 60 MB of disk space. The installed AWS CLI remains fully functional in its system directories.

Method 2: Installing AWS CLI via APT Repository

Debian’s package repository includes AWS CLI, offering a simpler installation process that integrates with your system’s package manager for streamlined updates.

First, update your package list:

sudo apt update

Then install AWS CLI:

sudo apt install awscli -y

The APT method automatically handles dependencies and completes installation with a single command. However, repository versions often lag behind the latest AWS CLI releases, meaning you might miss recent features or improvements. Use this method when convenience outweighs having the absolute latest version. System administrators managing multiple servers often prefer APT installation for consistency across fleets.

Verify the installed version:

aws --version

Method 3: Installing AWS CLI Using Pip

Python’s package manager offers another installation route. First, ensure pip is installed:

sudo apt install python3-pip -y

Then install AWS CLI through pip:

pip install awscli --break-system-packages

The --break-system-packages flag is necessary on Debian 12 and 13 due to PEP 668 restrictions that prevent pip from modifying system Python packages. Alternatively, create a Python virtual environment to avoid this requirement:

python3 -m venv awscli-env
source awscli-env/bin/activate
pip install awscli

Virtual environments provide isolated Python spaces, preventing conflicts with system packages. This approach suits developers already working within Python environments.

Method 4: Installing AWS CLI Using Snap

Snap packages offer containerized applications with built-in dependencies. Install snapd first:

sudo apt install snapd

Then install AWS CLI from the Snap Store:

sudo snap install amz-aws-cli

Snap installations run in confined environments with strict security boundaries. This isolation occasionally causes path or permission complications. Most users prefer traditional installation methods for better system integration.

Configuring AWS CLI on Debian 13

Installation is only half the setup. AWS CLI requires configuration with your credentials and regional preferences before it can interact with AWS services.

Obtaining AWS Credentials

Log into your AWS Management Console and navigate to IAM. Select your user account, then click the Security credentials tab. Create a new access key, which generates an Access Key ID and Secret Access Key.

Download and store these credentials securely. Never commit them to version control or share them publicly. AWS access keys provide full account access within their permission scope.

Running AWS Configure

Execute the configuration wizard:

aws configure

The command prompts for four pieces of information:

  • AWS Access Key ID — Paste your access key ID here.
  • AWS Secret Access Key — Enter your secret access key.
  • Default region name — Specify your preferred AWS region (e.g., us-east-1, eu-west-1, ap-southeast-1). Choose a region geographically close to reduce latency.
  • Default output format — Select json, table, or text. JSON provides the most flexibility for parsing command output.

Press Enter after each input. Your credentials are saved to ~/.aws/credentials, while region and format preferences go to ~/.aws/config.

Understanding Configuration Files

AWS CLI stores configuration in two files within your home directory.

The ~/.aws/credentials file contains authentication data:

[default]
aws_access_key_id = AKIAIOSFODNN7EXAMPLE
aws_secret_access_key = wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

The ~/.aws/config file holds preferences:

[default]
region = us-east-1
output = json

Both files use INI format with profile-based sections. File permissions default to 600 — readable and writable by the owner only — protecting your credentials from unauthorized access.

Setting Up Multiple AWS Profiles

Managing multiple AWS accounts requires named profiles. Create additional profiles with:

aws configure --profile production

Switch between profiles using the --profile flag:

aws s3 ls --profile production

Or set the environment variable:

export AWS_PROFILE=production

Multiple profiles prevent accidental operations on wrong accounts — a crucial safety measure for production environments.

Verifying AWS CLI Installation and Configuration

Test your setup with identity verification:

aws sts get-caller-identity

Successful authentication returns JSON output containing your UserId, Account number, and ARN:

{
    "UserId": "AIDAI23HXN2OQT4EXAMPLE",
    "Account": "123456789012",
    "Arn": "arn:aws:iam::123456789012:user/username"
}

Try additional commands to verify service access:

  • List S3 buckets: aws s3 ls
  • Describe EC2 instances: aws ec2 describe-instances
  • List available regions: aws ec2 describe-regions --output table
  • Check IAM user: aws iam get-user

These commands confirm both installation and credential configuration. Permission errors indicate IAM policy restrictions rather than installation problems.

Common AWS CLI Commands for Beginners

Start your AWS CLI journey with these fundamental operations.

S3 Operations

  • Create bucket: aws s3 mb s3://my-bucket-name
  • Upload file: aws s3 cp localfile.txt s3://my-bucket/
  • Download file: aws s3 cp s3://my-bucket/file.txt ./
  • List contents: aws s3 ls s3://my-bucket/
  • Delete object: aws s3 rm s3://my-bucket/file.txt

EC2 Operations

  • List instances: aws ec2 describe-instances
  • Start instance: aws ec2 start-instances --instance-ids i-1234567890abcdef0
  • Stop instance: aws ec2 stop-instances --instance-ids i-1234567890abcdef0
  • Create key pair: aws ec2 create-key-pair --key-name MyKeyPair

IAM Operations

  • List users: aws iam list-users
  • Create user: aws iam create-user --user-name newuser
  • Attach policy: aws iam attach-user-policy --user-name newuser --policy-arn arn:aws:iam::aws:policy/ReadOnlyAccess

Practice these commands in a safe development environment before running them in production.

Troubleshooting Common Issues

Even straightforward installations encounter occasional hiccups. Here are the most frequent problems and their fixes.

“Command Not Found” Error

If aws --version returns “command not found,” your PATH variable doesn’t include the AWS CLI location. Add it by editing .bashrc:

echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
source ~/.bashrc

This modification makes the aws command accessible in new terminal sessions. Restart your terminal or source the configuration file to apply changes immediately.

Permission Denied Errors

Installation permission issues typically stem from incorrect file ownership or missing execution permissions. Fix directory permissions:

sudo chmod -R 755 /usr/local/aws-cli/

Make the binary executable:

chmod +x /usr/local/bin/aws

Credential and Authentication Errors

“Invalid security token” or “Access Denied” messages indicate credential problems. Verify your access key format — no extra spaces or characters. Check credential expiration in the IAM console.

Enable debug mode for detailed error information:

aws s3 ls --debug

Debug output reveals authentication flow details and pinpoints failure points. Region mismatches cause confusing errors — ensure your configured region matches where your resources exist.

SSL Certificate Errors

Certificate verification failures often result from outdated system certificates or incorrect system time. Update certificates:

sudo apt install ca-certificates

Synchronize system time:

sudo ntpdate pool.ntp.org

Correct time is crucial for SSL handshakes and AWS request signing.

Updating AWS CLI on Debian 13

Keep AWS CLI current for the latest features and security patches.

For official installer installations, download the latest version and run:

sudo ./aws/install --update

The --update flag replaces your existing installation while preserving configurations.

APT installations update through standard system updates:

sudo apt update && sudo apt upgrade awscli

Pip installations upgrade with:

pip install --upgrade awscli

Check your current version before updating to track changes between releases.

Advanced Configuration Tips

Power users leverage environment variables and advanced configuration options.

Set credentials temporarily using environment variables:

export AWS_ACCESS_KEY_ID=your_access_key
export AWS_SECRET_ACCESS_KEY=your_secret_key
export AWS_DEFAULT_REGION=us-west-2

These variables override profile configurations — perfect for temporary testing without modifying configuration files.

Enable command completion for bash to speed up command composition:

complete -C '/usr/local/bin/aws_completer' aws

Integrate AWS CLI with jq for advanced JSON manipulation:

aws ec2 describe-instances | jq '.Reservations[].Instances[].InstanceId'

Combine CLI commands in automation scripts, Ansible playbooks, or CI/CD pipelines to unlock the true power of infrastructure as code.

Congratulations! You have successfully installed AWS CLI. Thanks for using this tutorial for installing AWS CLI on the Debian 13 “Trixie” system. For additional help or useful information, we recommend you check the AWS CLI website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button