Ubuntu users, looking to harness the power of Amazon's Elastic Compute Cloud (EC2) instances from the command line? You're in the right place. Installing the AWS CLI (Command Line Interface) on Ubuntu is a straightforward process, and this guide will walk you through it step by step. By the end, you'll be well on your way to managing your AWS resources like a pro.
Before we dive in, ensure your Ubuntu system is up-to-date. This will ensure that the necessary dependencies for installing the AWS CLI are available. Let's start by updating your system packages and then we'll install the necessary tools.
Update and Upgrade Ubuntu
Before installing any new software, it's a good practice to ensure your system is up-to-date. This will help prevent any compatibility issues and ensure your system is secure.
To update your system, open a terminal and type the following commands, pressing Enter after each:
Update the package list
sudo apt update
This command fetches the latest information about available updates.
Upgrade installed packages
sudo apt upgrade
This command upgrades installed packages to their latest versions.
Install Dependencies
Now that your system is up-to-date, you need to install some dependencies before you can install the AWS CLI.
Unix-like operating systems like Ubuntu use the package manager apt to handle dependencies. The necessary dependencies for the AWS CLI are curl and unzip, both of which can be installed using apt-get.
Install curl
sudo apt install -y curl
curl is a command-line tool used to make HTTP requests from the command line. It's a dependency for the AWS CLI.
Install unzip
sudo apt install -y unzip
unzip is a command-line tool used to extract ZIP files. It's another dependency for the AWS CLI.
Install the AWS CLI
With the dependencies installed, you're ready to install the AWS CLI.
The AWS CLI is shipped as a ZIP file, which is why we needed unzip. The installation process involves downloading the ZIP file, extracting it, and configuring it. Let's get started.
Download the AWS CLI
Use curl to download the AWS CLI installer to your /tmp directory:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Install the AWS CLI
Unzip the downloaded file and navigate to the extracted directory:
unzip awscliv2.zip
cd aws
Now, run the installer:
sudo ./aws/install
Verify the Installation
To confirm that the AWS CLI has been installed correctly, you can check the version:
aws --version
This command should display the version number of the installed AWS CLI.
Congratulations! You've successfully installed the AWS CLI on your Ubuntu system.
Configure the AWS CLI
Before you can use the AWS CLI, you need to configure it with your AWS credentials. Run the following command:
aws configure
This will prompt you for your Access Key ID, Secret Access Key, default region, and output format. Enter your credentials, select your preferred region and output format, and the AWS CLI is ready to use.
Test the AWS CLI
List S3 buckets to confirm that everything is working properly:
aws s3 ls
Now that you have the AWS CLI installed and configured on your Ubuntu system, you're ready to start managing your AWS resources from the comfort of your terminal. Happy AWS-ing!












