Linux MintUbuntu Based

How To Install AWS CLI on Linux Mint 22

Install AWS CLI on Linux Mint 22

Managing Amazon Web Services from the command line offers unparalleled flexibility and efficiency for cloud administrators and developers. The AWS Command Line Interface (CLI) transforms how you interact with AWS services, enabling automation, scripting, and rapid deployment without navigating through web consoles. This comprehensive guide walks you through installing AWS CLI on Linux Mint 22, configuring it properly, and troubleshooting common issues you might encounter.

Linux Mint 22, built on Ubuntu’s solid foundation, provides an excellent environment for AWS CLI operations. Whether you’re deploying EC2 instances, managing S3 buckets, or orchestrating complex cloud infrastructure, mastering AWS CLI installation is your first step toward cloud automation excellence.

We’ll cover three proven installation methods: APT package manager, Python pip, and the official AWS installer script. Each method has distinct advantages, and you’ll learn which suits your specific needs best.

What is AWS CLI?

AWS CLI is an open-source command-line tool that unifies control of multiple Amazon Web Services under one interface. Instead of switching between different web consoles, you execute commands directly from your terminal. This powerful utility communicates directly with AWS APIs, giving you programmatic access to virtually every AWS service.

The benefits extend beyond convenience. Automation becomes possible through shell scripts and cron jobs. Infrastructure-as-code practices flourish when you can script your entire AWS environment. DevOps teams particularly value AWS CLI for CI/CD pipelines and deployment automation.

AWS CLI version 2 represents the current generation, offering improved performance and new features compared to version 1. Amazon actively develops and recommends version 2 for all new installations. The tool supports JSON, YAML, text, and table output formats, making it adaptable to various scripting and parsing needs.

Prerequisites

Before beginning the installation process, ensure your system meets these requirements. Linux Mint 22 should be updated to the latest package versions. You’ll need an active AWS account with administrative access to the IAM console.

Root or sudo privileges on your Linux Mint system are essential for installation. Most installation steps require elevated permissions to write to system directories. Basic command-line familiarity will make the process smoother, though we’ll explain each command thoroughly.

You must have IAM user credentials ready: specifically an Access Key ID and Secret Access Key. These credentials authenticate your AWS CLI commands. A stable internet connection enables downloading installation packages and communicating with AWS services.

The unzip utility comes pre-installed on Linux Mint 22, but verify its presence if you encounter extraction issues. Python 3 is also pre-installed, which benefits certain installation methods.

Method 1: Installing AWS CLI Using APT Package Manager

The APT package manager offers the simplest installation path for Linux Mint users. This method integrates seamlessly with your system’s package management, making updates and removal straightforward.

Update System Packages

Open your terminal application. First, refresh your package database to ensure you’re installing the latest available versions:

sudo apt update

This command contacts Ubuntu’s repositories and updates the local package index. You’ll see package lists being downloaded. The process typically completes within 30 seconds, depending on your connection speed and how recently you’ve updated.

Install AWS CLI via APT

Execute the installation command:

sudo apt install awscli -y

The -y flag automatically confirms the installation prompt. APT resolves all dependencies automatically, downloading and installing required libraries. The installation process typically takes one to two minutes.

You’ll see progress indicators as packages download and install. APT handles everything behind the scenes, placing executables in system paths that your terminal can access immediately.

Verify Installation

Confirm AWS CLI installed correctly:

aws --version

The output displays the installed version, typically showing AWS CLI 1.x.x for APT installations. While not the absolute latest version, it remains functional and stable for most use cases.

Pros and Cons

APT installation shines in simplicity and integration with system package management. Updates arrive through your regular system update process. However, the version lags behind AWS’s latest releases. If you need cutting-edge features, consider alternative installation methods.

Method 2: Installing AWS CLI Using Python Pip

Python developers often prefer the pip installation method. It offers more version control flexibility while maintaining reasonable simplicity.

Install Python pip

Linux Mint 22 includes Python 3 by default. However, pip may require separate installation:

sudo apt-get install python3-pip

This command adds pip, Python’s package installer, to your system. Pip manages Python packages independently of system package managers, offering more granular control over Python environments.

Upgrade pip

Before installing AWS CLI, upgrade pip to its latest version:

sudo pip3 install --upgrade pip

Recent pip versions include security patches and performance improvements. This step prevents potential installation issues caused by outdated pip versions.

Install AWS CLI via pip

Now install AWS CLI through pip:

sudo pip3 install awscli

Pip downloads AWS CLI and all Python dependencies automatically. The installation takes two to three minutes as pip compiles and configures components. You’ll see progress bars and package names scrolling past.

Verify Installation

Check the installation succeeded:

aws --version

The version command confirms AWS CLI is accessible from your PATH. Pip installations typically provide more recent versions than APT.

Evaluation

This method works excellently if you’re already managing Python environments. Python developers appreciate pip’s integration with their existing workflows. However, it requires maintaining Python dependencies separately from system packages, which adds minimal complexity.

Method 3: Installing AWS CLI Using Official Installer Script (Recommended)

Amazon officially recommends this installation method for Linux systems. It consistently delivers the latest AWS CLI version 2, independent of distribution package cycles.

Why Choose This Method

The official installer provides several advantages. You always get AWS CLI version 2 with the newest features and security updates. The installation works identically across all Linux distributions, from Ubuntu to Fedora. It operates independently from system package managers, preventing conflicts.

AWS maintains this installer actively, ensuring compatibility with their latest service features. Most importantly, you control when to update rather than relying on distribution maintainers.

Download AWS CLI Installation Package

Use curl to download the installer:

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

This command contacts AWS’s download server and saves the installer as awscliv2.zip in your current directory. The file size is approximately 50-60 MB. Download time varies with your connection speed, typically completing within two minutes.

If curl isn’t installed, use wget instead:

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

Both commands achieve the same result. Verify the download completed by checking the file size matches expectations.

Extract the Downloaded Package

Unzip the installer package:

unzip awscliv2.zip

This creates a new directory named “aws” in your current location. The extraction process takes just seconds. You’ll see files being extracted with progress indicators.

List the directory contents:

ls aws/

You should see the install script and several supporting files. This confirms extraction completed successfully.

Run the Installer

Execute the installation script with sudo privileges:

sudo ./aws/install

The system prompts for your password since the installer writes to protected system directories. The installer creates files in /usr/local/aws-cli and establishes a symbolic link in /usr/local/bin.

Installation output confirms each step, showing where files are placed. The process completes in under a minute. You’ll see a success message when finished.

Verify Installation

Confirm AWS CLI version 2 installed correctly:

aws --version

The output should show “aws-cli/2.x.x” indicating version 2. This confirms you’re running the latest generation.

Check the installation path:

which aws

This typically returns /usr/local/bin/aws, confirming the symlink works properly.

Test basic functionality:

aws help

The help documentation displays, proving AWS CLI responds to commands.

Configuring AWS CLI

Installation alone doesn’t enable AWS CLI functionality. You must configure authentication credentials to communicate with AWS services.

Creating IAM Access Keys in AWS Console

Log into the AWS Management Console through your web browser. Navigate to the IAM (Identity and Access Management) service. This service manages AWS permissions and credentials.

Click on your username or the “Users” section, then select “Security credentials”. Scroll to the “Access keys” section. Click “Create access key” to generate new credentials.

AWS displays your Access Key ID and Secret Access Key. Download the CSV file containing these credentials immediately. You cannot retrieve the Secret Access Key again after closing this window. Store the CSV file securely, treating it like a password.

Never commit access keys to version control systems like Git. Never share them publicly or embed them in code. Treat these credentials with the same security as your AWS console password.

Running AWS Configure Command

Return to your Linux Mint terminal. Execute the configuration command:

aws configure

AWS CLI prompts for four pieces of information:

AWS Access Key ID: Paste your Access Key ID from the downloaded CSV file. This identifies your IAM user.

AWS Secret Access Key: Enter your Secret Access Key. Characters won’t display as you type for security reasons.

Default region name: Specify your preferred AWS region. Common choices include us-east-1 (N. Virginia), us-west-2 (Oregon), eu-west-1 (Ireland), or ap-southeast-1 (Singapore). Choose the region geographically closest to you or where your resources primarily reside.

Default output format: Select json, yaml, text, or table. JSON works best for scripting and parsing. YAML offers human-readable output. Table format suits manual command execution.

AWS CLI saves these configurations in ~/.aws/config and ~/.aws/credentials files. These files contain your settings in plain text, so protect their permissions appropriately.

Alternative: Using Environment Variables

Some scenarios benefit from environment variables instead of configuration files. CI/CD systems and containerized environments commonly use this approach.

Set environment variables in your terminal:

export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
export AWS_DEFAULT_REGION="us-east-1"

These variables take precedence over configuration files. They persist only for the current session unless added to your shell profile files like .bashrc or .bash_profile.

Verifying AWS CLI Configuration

Test your configuration with the identity command:

aws sts get-caller-identity

Successful authentication returns JSON output showing your Account ID, User ARN, and User ID. This confirms AWS recognizes your credentials and the CLI communicates properly.

Alternatively, list your S3 buckets:

aws s3 ls

This displays all S3 buckets in your account. An empty list is normal if you haven’t created buckets yet. Errors indicate configuration problems requiring troubleshooting.

Review your configuration settings:

aws configure list

This command displays your current configuration sources, showing which settings come from configuration files versus environment variables.

Common Troubleshooting Issues

Even careful installation sometimes encounters problems. These solutions address the most frequent issues.

Command Not Found Error

If the terminal reports “aws: command not found,” the AWS CLI executable isn’t in your system PATH. This usually happens with the official installer method.

Add AWS CLI to your PATH by editing .bashrc:

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

Alternatively, restart your terminal completely. New terminals automatically load updated PATH variables.

Invalid Credentials Errors

The error “InvalidClientTokenId” means AWS doesn’t recognize your Access Key. Double-check you copied the complete Access Key ID without extra spaces or characters.

Verify your Secret Access Key similarly. These credentials are case-sensitive and must match exactly. If problems persist, regenerate credentials in the IAM console and reconfigure AWS CLI.

Check your IAM user has appropriate permissions. Lack of permissions produces different errors than invalid credentials, but both prevent operations.

SSL Certificate Errors

SSL validation failures typically indicate outdated system SSL certificates. Update your system packages:

sudo apt update
sudo apt upgrade

This installs the latest SSL certificate packages along with other updates. Restart your terminal after updating.

No Region Set Error

If commands fail with “You must specify a region,” your configuration lacks a default region. Run aws configure again and specify your preferred region.

Alternatively, set the region via environment variable:

export AWS_DEFAULT_REGION="us-east-1"

You can also specify region per command using the --region flag.

Version Conflicts

Multiple AWS CLI versions installed simultaneously cause confusion about which version executes. Check which version your terminal finds:

which aws
aws --version

If the wrong version appears, remove older installations. APT and pip installations can coexist with the official installer, but only one should be active in your PATH.

Updating AWS CLI

Regular updates provide new features, performance improvements, and security patches. Update methods depend on your installation approach.

For APT installations:

sudo apt update
sudo apt upgrade awscli

This updates AWS CLI along with other system packages.

For pip installations:

sudo pip3 install --upgrade awscli

Pip downloads and installs the latest version available through PyPI.

For official installer versions, re-run the installer with the update flag:

sudo ./aws/install --update

This overwrites the existing installation with the newest version. Download the latest installer package first if you’ve deleted the original download.

Check your version before and after updating to confirm the process succeeded. Establish a regular update schedule, perhaps monthly, to stay current with AWS developments.

Uninstalling AWS CLI

Removing AWS CLI cleanly prevents conflicts if you need to reinstall or switch installation methods.

For APT installations:

sudo apt remove awscli
sudo apt autoremove

The first command removes AWS CLI. The second cleans up orphaned dependencies no longer needed.

For pip installations:

sudo pip3 uninstall awscli

Confirm the uninstallation when prompted.

For official installer versions:

sudo rm /usr/local/bin/aws
sudo rm /usr/local/bin/aws_completer
sudo rm -rf /usr/local/aws-cli

These commands remove the symlink and installation directory. Optionally delete your configuration:

rm -rf ~/.aws/

This removes saved credentials and configuration files. Only do this if you’re certain you won’t need them.

Congratulations! You have successfully installed AWS CLI. Thanks for using this tutorial for installing AWS CLI on the Linux Mint 22 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