Intro
Whether you’ve been using AWS for some time or you are a novice, you may have noticed that there’s more to AWS than the default browser console. Maybe it’s time you checked out the AWS CLI (Command Line Interface). One important reason is that AWS CLI provides you to unlock further potential when managing your AWS environment. This article will show you how to install AWS CLI v2 on your Linux machine.
What is AWS CLI?
AWS CLI is a unified tool using which, you can manage and monitor all your AWS services from a terminal session on your client.
The AWS CLI manages your AWS services from a terminal session on your own client. It allows you to control and configure multiple AWS services and implement a level of automation. AWS CLI enables you to interact and provides direct access to the public APIs of AWS services. You can run AWS CLI commands from a Windows machine, and use command prompt or PowerShell to execute AWS CLI commands.
How to install AWS CLI v2 on a Linux Ubuntu machine?
Before proceeding with the installation, there are some prerequisites:
- You must be capable of extracting or “unzipping” the downloaded package.
- The AWS CLI uses glibc, groff, and less. Check your distro if it is included by default or download it.
- Amazon supports the AWS CLI on 64-bit versions of the latest distributions of CentOS, Fedora, Ubuntu, Amazon Linux 1, Amazon Linux 2 and Linux ARM.
- Please be aware that third-party repositories may not contain the latest version of the AWS CLI.
Installation Steps
Now that you have the knowledge to pay attention to. Let’s learn how to install AWS CLI v2 on a Linux Ubuntu machine through the command line.
1. Download the AWS CLI installer file using the curl command. The -o option specify the file name in which your package will be written. For instance, the package will be downloaded to the current directory with the local name awscliv2.zip
in our demo.
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" unzip awscliv2.zip sudo ./aws/install


2. We have a zip file and now we will unzip the installer. The following command unzips the package and creates a directory named aws
under the current directory.
unzip awscliv2.zip ls -l


3. Run the command below to install AWS CLI. Default path which the files are all installed is /usr/local/aws-cli
, and a symbolic link will be in /usr/local/bin
. Lastly, you need to use sudo
to grant write permissions to those directories.
sudo ./aws/install aws --version

4. If you don’t want to use sudo
or you are not root user, you can specify directories that you already have write permissions to. Use the install
command with -i and -b parameters. Note that no volume name or directory names that contain any space characters or other white space characters are allowed, otherwise the installation fails.
### TO INSTALL DIFFERENT DIRECTORY AND PATH DONT RUN IF YOU ALREADY INSTALLED IN THE PREVIOUS STEP ./aws/install -i /usr/local/aws-cli -b /usr/local/bin
--install-dir
 orÂ-i
 specifies the directory to copy all of the files to. The default one is /usr/local/aws-cli.- –bin-dir or -b option specifies that the main aws program in the install directory is symbolically linked to the file aws in the specified path. Writing permissions to the specified directory is mandatory. Once you use a directory that is already in your path, it eliminates the need to add the install directory to the user’s $PATH variable. The default value isÂ
/usr/local/bin
.
How to configure AWS CLI v2 after installation on Windows?
For general use, the fastest way to set up your AWS CLI installation is the aws configure
command. When you execute this command, the AWS CLI prompts you to enter four pieces of information:
Get your access and secret keys via Console
Access and secret keys are indispensable for secure programmatic access to your AWS account. To get them please click follow the steps here.
1. Open your web browser and navigate to the AWS Management Console and log in.
2. While in the Console, click on the search bar at the top, search for ‘IAM’, and click on the IAM menu item.

3. To find or create the user you operate, click on Users. After selecting the user, navigate to the Security credentials tab inside user’s dashboard. Choose to Create an access key and download the .csv file. Both your access and secret keys are in that file.


Configure AWS CLI
Configure AWS Credentials by running the aws configure command on the command prompt. Enter the details such as AWS Access key ID, Secret Access Key, and AWS region. You can skip as output format default json, or enter the output format as text or yaml.
aws configure

Conclusion
In this article, you learned What is AWS CLI, how to install AWS CLI version 2 on Linux Ubuntu, and also how to configure it by aws configure
method as well as creating access and secret keys credentials over AWS Console. Try out today and ask your question if any.
Thanks.