Geekflare is supported by our audience. We may earn affiliate commissions from buying links on this site.
In Cloud Computing Last updated: November 4, 2022
Share on:
Invicti Web Application Security Scanner – the only solution that delivers automatic verification of vulnerabilities with Proof-Based Scanning™.

AWS Command Line Interface or CLI is a set of open-source tools that allows you to manage and automate AWS services using commands.

AWS CLI supports multiple platforms like Windows, Linux, and macOS and provides direct access to public APIs for AWS. Further, automation of tedious infrastructure tasks is easily possible in a CLI environment.

AWS CLI Versions

AWS CLI has two major versions available, i.e., version 1.x, which is available for backward compatibility while version 2.x is the current general release available and is intended for production use. It’s not completely backward compatible and hence scripts that use version 1 of AWS CLI may not be compatible with version 2.

Install AWS CLI

Here we’ll be covering the installation of AWS CLI on different platforms. Since version 2.x is the general release available at the time of this writing we’ll be only covering the installation of the same.


The official method of installation of AWS CLI on Linux-based systems is available via a ZIP package. It requires a 64 bit/ARM Linux system and assumes that the system already has unzip, glibc, groff and less packages installed and available for use. All major Linux distributions are supported like CentOS, Fedora, Ubuntu, and Amazon Linux.

To install the latest version of AWS CLI on Linux x86 (64-bit), use the following commands:

$ curl "" -o ""
sudo ./aws/install

To confirm successful installation, run:

$ aws --version
aws-cli/2.2.5 Python/3.8.8 Linux/4.14.133-113.105.amzn2.x86_64 botocore/2.0.0


macOS installation of AWS CLI is officially offered in GUI as well CLI methods. To go the GUI way, download the latest version of the AWS CLI package from the following link: and double click the downloaded package to launch the installer.

Follow the on-screen instructions to complete the installation. Most of the options can be left as default for normal installation requirements.

If you want to install using CLI way, on a new terminal issue below commands to download and install the latest AWS CLI version:

$ curl "" -o "AWSCLIV2.pkg"
$ sudo installer -pkg AWSCLIV2.pkg -target /

sudo in above command is needed if you plan to install it system-wide. If you want to install as a local user without admin rights, there’s a simple official workaround.

You need to create a XML file that will provide a path /Users/myusername where you want AWS CLI to be installed. This path should be an existing directory or created before launching the installer else it’ll fail.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Then you can proceed to download the latest installation package using curl as:

$ curl "" -o "AWSCLIV2.pkg"

Once you have the package and the XML configuration file ready, AWS CLI can be installed for the local user using:

$ installer -pkg AWSCLIV2.pkg \
            -target CurrentUserHomeDirectory \
            -applyChoiceChangesXML choices.xml

Here AWSCLIV2.pkg is the package that we downloaded in an earlier step using curl and -target specifies that installation is for local user and -applyChoiceChangesXML basically indicates to the installer that we’ll be using custom choices that contain our relative installation path /Users/myusername or whatever the local directory path has been specified in the XML.

As the last step, run the following commands to create the required symlinks which are required by AWS CLI to work correctly.

$ sudo ln -s /folder/installed/aws-cli/aws /usr/local/bin/aws
$ sudo ln -s /folder/installed/aws-cli/aws_completer /usr/local/bin/aws_completer

If your $PATH includes a directory that you can write to and you specify that directory as the target’s path, you can run the above command without sudo. But if you don’t have a writable directory in your $PATH, you must use sudo for permissions to write to the specified target folder. The default location for a symlink is /usr/local/bin/.

To verify the install, use:

$ which aws
$ aws --version
aws-cli/2.1.29 Python/3.7.4 Darwin/18.7.0 botocore/2.0.0


For a Windows install, AWS CLI v2 requires a Windows 64-bit version or later and admin rights for installation.

The latest Windows installation package can be downloaded from: and launched with admin rights for installation to complete.

Alternatively, you can use misexec in CLI to install on the command line as:

msiexec.exe /i

You can use aws --version in a command prompt to verify the install.

C:\>aws --version
aws-cli/2.2.7 Python/3.8.8 Windows/10 exe/AMD64 prompt/off


Finally, if you don’t want to install AWS CLI on your local OS and happen to have access to Docker, it is just a matter of single command to execute AWS CLI commands as:

$ docker run --rm -it amazon/aws-cli command

where command is the AWS CLI command to execute. The above command will launch a container with the required AWS CLI setup and will directly proceed to execute the specified command and exit once it’s done.

There’s a bunch of options to use your existing AWS CLI credentials, configuration, and environment variables as an input for the container that makes it all the more usable and portable. There’s also an alias option to shorten the long docker command to something simple and comprehensible like for Linux host use:

$ alias aws='docker run --rm -it amazon/aws-cli'

Make sure to add the above command in your shell’s profile file for persistence. Once done, you can use it like:

$ aws --version
aws-cli/2.1.29 Python/3.7.3 Linux/4.9.184-linuxkit botocore/2.0.0dev10

Easy and looks better. Read more about AWS CLI Docker-based offering and possibilities here.


AWS CLI offers a command-based experience to manage your AWS infrastructure with ease of control especially with repetitive tasks and ultimately opens the door for automation and managing Infrastructure as Code (IaC). You learned about how to install it on different platforms. As a next step, you can read here on how to configure it to use it with your AWS account.

  • Abhishek Nair
Thanks to our Sponsors
More great readings on Cloud Computing
Power Your Business
Some of the tools and services to help your business grow.
  • Invicti uses the Proof-Based Scanning™ to automatically verify the identified vulnerabilities and generate actionable results within just hours.
    Try Invicti
  • Web scraping, residential proxy, proxy manager, web unlocker, search engine crawler, and all you need to collect web data.
    Try Brightdata
  • is an all-in-one work OS to help you manage projects, tasks, work, sales, CRM, operations, workflows, and more.
    Try Monday
  • Intruder is an online vulnerability scanner that finds cyber security weaknesses in your infrastructure, to avoid costly data breaches.
    Try Intruder