How to Install AWS CLI on Ubuntu
To install the AWS CLI (Command Line Interface) on Ubuntu follow below steps.
The AWS CLI (Amazon Web Services Command Line Interface) is a unified tool that allows users to interact with various AWS services from the command line or terminal. It provides a way to automate AWS tasks, manage resources, and perform operations programmatically without using the AWS Management Console.
Update the package
First, ensure that your package is up to date by running the following commands:
sudo apt update
sudo apt upgrade -y
Install the AWS CLI Using the Official Installer
Download the AWS CLI v2 Installation Package
AWS CLI version 2 is the latest version. Download it using the curl
command:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
Unzip the Installation Package
Install the unzip
utility if you don’t have it already.
sudo apt install unzip -y
Then, unzip the AWS CLI installer.
unzip awscliv2.zip
2.3. Install the AWS CLI
Run the installer.
sudo ./aws/install
Verify the Installation
To ensure that the AWS CLI is installed correctly, you can check the version:
aws --version
The output should be similar to
aws-cli/2.x.x Python/3.x.x Linux/Ubuntu
Configure the AWS CLI
After installation, you need to configure the AWS CLI with your AWS credentials.
aws configure
You will be prompted to enter the following details.
AWS Access Key ID: (From your AWS account)
AWS Secret Access Key: (From your AWS account)
Default region name: (e.g.,
us-west-2
,us-east-1
, etc.)Default output format: (e.g.,
json
,text
,table
)
Start Using the AWS CLI
Once configured, you can start using the AWS CLI to interact with your AWS services. For example, you can run a command to list your S3 buckets:
aws s3 ls
Uninstall the AWS CLI
If you ever need to uninstall the AWS CLI, you can run the following command:
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
This will remove the AWS CLI from your system.
Subscribe to my newsletter
Read articles from Ankita Lunawat directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Ankita Lunawat
Ankita Lunawat
I am a dedicated and experienced Cloud Engineer with two years in the industry, specializing in designing, implementing, and managing scalable and secure cloud infrastructures. With a strong foundation in AWS, Azure, and GCP, I excel at leveraging cloud services to optimize performance, enhance security, and reduce operational costs. My expertise includes automated deployment pipelines, infrastructure as code (IaC) with tools like Terraform and container orchestration using Kubernetes and Docker. Throughout my career, I've collaborated with cross-functional teams to deliver robust cloud solutions, ensuring high availability and fault tolerance. I'm passionate about staying at the forefront of cloud technology trends and continuously enhancing my skill set to provide innovative solutions that drive business success. Whether it's migrating legacy systems to the cloud or architecting new cloud-native applications, I bring a strategic approach to every project, focusing on efficiency, scalability, and reliability. In addition to my technical skills, I am an advocate for DevOps practices, promoting a culture of collaboration and continuous improvement within development and operations teams. My commitment to learning and adapting to new technologies ensures that I can meet the evolving needs of any organization and deliver top-tier cloud solutions.