Debian

How to Install AWS CLI on Debian 12

AWS CLI is a robust command-line tool developed for Linux systems including Debian 12 that allows you to interact with Amazon Web Services and manages it right from the terminal. With AWS CLI, you can construct and manage AWS services like Amazon Lamba, S3 object storage, EC2 instances and more. With minimal configuration and using simple commands, you will be able to implement functionality similar to what you do on the browser-based AWS Management Console.

In this guide, you will find:

How to Install AWS CLI on Debian 12

You can install AWS CLI on Debian 12 from:

How to Install AWS CLI on Debian 12 from Source Repository

AWS CLI is available in the default Debian repository, making it the most straightforward approach to install it. You can install AWS CLI on Debian 12 from the source repository using the below-given apt install command:

sudo apt install awscli -y

After the installation, you can check the AWS CLI version using the below-given command to ensure it is successfully installed on Debian 12:

aws --version

How to Remove AWS CLI from Debian 12

If you have installed AWS CLI from the default repository, you can remove it any time from Debian system using the below-given command:

sudo apt remove awscli -y

How to Install AWS CLI on Debian 12 from pip Installer

You can also install AWS CLI on Debian 12 from the pip installer besides installing it from the source repository. The advantage of installing AWS CLI through pip is that you will be able to install an updated version of the application.

To install AWS CLI on Debian 12, run the pip command followed by the awscli keyword and –break-system-packages to ensure it is installed without an externally managed environment error:

pip3 install awscli --break-system-packages

Note: If you are using another Debian version, you don’t need to add the –break-system-packages keyword.

How to Remove AWS CLI from pip on Debian 12

If you want to remove AWS CLI installed through pip on Debian 12, simply run the following command:

pip3 uninstall awscli --break-system-packages -y

How to Install AWS CLI on Debian 12 Through Zip File

If you want to install the AWS CLI latest version on Debian 12, you can download the zip file from the official AWS website and then install CLI through it. The step-by-step guide to install AWS CLI through the zip file is provided below:

Step 1: Download AWS CLI Zip File

First, download the AWS CLI zip file on Debian 12 from the terminal using the following command:

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

Note: If you experience curl command not found error, install curl on Debian 12 from the following command:

sudo apt install curl -y

Step 2: Unzip AWS CLI Zip File

Now, unzip the AWS CLI zip file on Debian 12 from the following command:

unzip awscliv2.zip

Step 3: Install AWS CLI on Debian 12

Next, navigate to AWS source directory on Debian using the cd command:

cd aws

Then run the AWS CLI installation script with sudo privileges on Debian using:

sudo ./install

Step 4: Check AWS CLI Version on Debian

To check AWS CLI is successfully installed on Debian 12, run the following command:

/usr/local/bin/aws --version

Step 5: Make AWS CLI Global

You must set the path environment for AWS CLI so that your system will know where it is installed. You can set the path variable for AWS CLI on Debian by opening the bashrc file using the following command:

sudo nano ~/.bashrc

Then add the following line inside this bashrc file:

export PATH="$PATH:/usr/local/bin/aws"

Step 6: Save the File and Changes

You must save the bashrc file using CTRL+X, add Y and press Enter, then use the source command to make the changes to the system:

source ~/.bashrc

Step 7: Check AWS CLI Version on Debian

To confirm AWS CLI is globally set for Debian users, simply run the following version command:

aws --version

How to Install AWS CLI on Debian 12 from Snap Store

You can also use Snap Store to install AWS CLI on Debian 12, this can be done using the following steps:

Step 1: Install Snap Daemon on Debian 12

First, install Snap Daemon on Debian 12 using the following command so that you will be able to use the snap command to install packages from the Snap Store:

sudo apt install snapd -y

Step 2: Install AWS CLI from Snap Store

You can now install AWS CLI on Debian 12 from the Snap Store using the following command:

sudo snap install aws-cli --classic

Note: Reboot the system in order to make changes after you have installed AWS CLI from the Snap Store.

How to Remove AWS CLI from Snap Store on Debian 12

You can remove AWS CLI from Snap Store on Debian 12 using the below-given command:

sudo snap remove aws-cli

How to Use AWS CLI on Debian 12

After you have successfully installed AWS CLI on Debian 12, it’s now time to configure it. For that, you must have an account on AWS; after creating an account, you will be provided with the Access Key ID, Secret Access Key and other login credentials. This information will be used during the configuration phase while running AWS CLI on Debian. For more details, check the configuration section of the guide.

Conclusion

AWS CLI is a powerful command-line utility used for interacting with the AWS from the terminal. You can install AWS CLI on Debian 12 directly through source repository or pip, but these methods install older versions of the utility. You can install the latest AWS CLI version via the zip method from the above section of this guide. Besides that, you can also use Snap Store to install a slightly older AWS CLI version on Debian 12 compared to the zip method. Once completed, you can use AWS CLI to start working with your AWS projects directly from the terminal.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.