Python 2.7, 3.4, and 3.5 are deprecated for the AWS CLI version 1. For more information see the AWS CLI version 1 section of About the AWS CLI versions.
Install, Update, and Uninstall the AWS CLI version 1 on Linux
You can install the AWS Command Line Interface (AWS CLI) version 1 and its dependencies
on most Linux
distributions by using the pip package manager or the bundled installer.
Although the awscli package is available in repositories for other package
managers such as apt and yum, these are not produced, managed, or
supported by AWS. We recommend that you install the AWS CLI from only the official
AWS
distribution points, as documented in this guide.
Sections
Prerequisites
You must have Python 2 version 2.7 or later, or Python 3 version 3.6 or later installed.
For installation instructions, see the Downloading Python
As of 2/1/2021 Python 3.4 and 3.5 is deprecated.
Python 2.7 was deprecated by the Python Software Foundation
In order to use the AWS CLI version 1 with an older version of Python, you need to install an earlier version of the AWS CLI version 1.
To view the AWS CLI version 1 Python version support matrix, see About the AWS CLI versions.
Install and uninstall the AWS CLI version 1 on Linux using the bundled installer
On Linux or macOS, you can use the bundled installer to install version 1 of the AWS CLI. The bundled installer includes all dependencies and can be used offline.
The bundled installer doesn't support installing to paths that contain spaces.
Topics
Install the AWS CLI version 1 using the bundled installer
with sudo
The following steps enable you to install the AWS CLI version 1 from the command line on any build of Linux or macOS.
The following is a summary of the installation commands explained below that you can cut and paste to run as a single set of commands.
For the latest version of the AWS CLI, use the following command block:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
For a specific version of the AWS CLI, append a hyphen
and the version number to the filename. For this example the filename for version
1.16.312 would be
awscli-bundle-1.16.312.zip resulting in the following command:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Follow these steps from the command line to install the AWS CLI version 1 using the bundled installer.
To install the AWS CLI version 1 using the bundled installer
-
Download the AWS CLI version 1 bundled installer using one of the the following methods.
-
Download using the
curlcommand.For the latest version of the AWS CLI, use the following command block:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For this example the filename for version
1.16.312would beawscli-bundle-1.16.312.zipresulting in the following command:$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" -
Download using the direct link.
For the latest version of the AWS CLI: https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For this example the filename for version
1.16.312would beawscli-exe-linux-aarch64-2.0.30.zipresulting in the following url https://s3.amazonaws.com/aws-cli/awscli-bundle-2.0.30.zip
-
-
Extract the files from the package. If you don't have
unzipto extract the files, use your Linux distribution's built-in package manager to install it.$unzip awscli-bundle.zip -
Run the install program. The installer installs the AWS CLI at
/usr/local/awsand creates the symlinkawsat the/usr/local/bindirectory. Using the-boption to create a symlink eliminates the need to specify the install directory in the user's$PATHvariable. This should enable all users to call the AWS CLI by enteringawsfrom any directory.$sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/awsBy default, the install script runs under the system default version of Python. If you have installed an alternative version of Python and want to use that version to install the AWS CLI, run the install script with that version by absolute path to the Python executable, as follows.
$sudo/usr/local/bin/python3.7awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws -
Verify that the AWS CLI installed correctly.
$aws --versionaws-cli/1.19.3 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13If you get an error, see Troubleshooting AWS CLI errors.
Install the AWS CLI version 1 using the bundled
installer without sudo
If you don't have sudo permissions or want to install the AWS CLI only for
the current user, you can use a modified version of the previous commands. The first
two
commands are the same.
For the latest version of the AWS CLI, use the following command block:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip ./awscli-bundle/install -b ~/bin/aws
For a specific version of the AWS CLI, append a hyphen
and the version number to the filename. For this example the filename for version
1.16.312 would be
awscli-bundle-1.16.312.zip resulting in the following command:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" unzip awscli-bundle.zip ./awscli-bundle/install -b ~/bin/aws
To install the AWS CLI version 1 for current user
-
Download the AWS CLI version 1 bundled installer in one of the following ways.
-
Download using the
curlcommand.For the latest version of the AWS CLI, use the following command block:
$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For this example the filename for version
1.16.312would beawscli-bundle-1.16.312.zipresulting in the following command:$curl "https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip" -o "awscli-bundle.zip" -
Download using the direct link.
For the latest version of the AWS CLI: https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For this example the filename for version
1.16.312would beawscli-exe-linux-aarch64-2.0.30.zipresulting in the following url https://s3.amazonaws.com/aws-cli/awscli-bundle-2.0.30.zip
-
-
Extract the files from the package by using
unzip. If you don't haveunzip, use your Linux distribution's built-in package manager to install it.$unzip awscli-bundle.zip -
Run the install program. The installer installs the AWS CLI at
/usr/local/awsand creates the symlinkawsat the/usr/local/bindirectory. The command uses the-bparameter to specify the directory where the installer places theawssymlink file. You must have write permissions to the specified folder.$./awscli-bundle/install -b ~/bin/awsThis installs the AWS CLI to the default location (
~/.local/lib/aws) and creates a symbolic link (symlink) at~/bin/aws. Make sure that~/binis in yourPATHenvironment variable for the symlink to work.$echo $PATH | grep ~/bin// See if $PATH contains ~/bin (output will be empty if it doesn't)$export PATH=~/bin:$PATH// Add ~/bin to $PATH if necessary -
Ensure the directory that the AWS CLI version 1 is part of your
PATHvariable.-
Find your shell's profile script in your user folder. If you're not sure which shell you have, run
echo $SHELL.$ls -a ~. .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads-
Bash –
.bash_profile,.profile, or.bash_login -
Zsh –
.zshrc -
Tcsh –
.tcshrc,.cshrcor.login
-
-
Add an export command at the end of your profile script that's similar to the following example.
export PATH=~/.local/bin:$PATHThis command inserts the path,
~/.local/binin this example, at the front of the existingPATHvariable. -
Reload the profile into your current session to put those changes into effect.
$source ~/.bash_profile
-
-
Verify that the AWS CLI installed correctly.
$aws --versionaws-cli/1.19.3 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13If you get an error, see Troubleshooting AWS CLI errors.
Uninstall the AWS CLI version 1 bundled installer
If you installed the AWS CLI using the bundled installer, follow these instructions. The bundled installer doesn't put anything outside of the installation directory except the optional symlink, so uninstalling is as simple as deleting those two items.
$sudo rm -rf /usr/local/aws$sudo rm /usr/local/bin/aws
Install and uninstall the AWS CLI version 1 using pip
Topics
Install pip
If you don't already have pip installed, you can install it by using the
script that the Python Packaging Authority provides. Run
pip --version to see if your version of Linux already includes Python and
pip. We recommend that if you have Python version 3 or later installed, you
use the pip3 command.
-
Use the
curlcommand to download the installation script. The following command uses the-O(uppercase "O")parameter to specify that the downloaded file is to be stored in the current directory using the same name it has on the remote host.$curl -O https://bootstrap.pypa.io/get-pip.py -
Run the script with the
pythonorpython3command to download and install the latest version ofpipand other required support packages. When you include the--userswitch, the script installspipto the path~/.local/bin.$python3 get-pip.py --user -
Ensure the directory that contains
pipis part of yourPATHvariable.-
Find your shell's profile script in your user folder. If you're not sure which shell you have, run
echo $SHELL.$ls -a ~. .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads-
Bash –
.bash_profile,.profile, or.bash_login -
Zsh –
.zshrc -
Tcsh –
.tcshrc,.cshrcor.login
-
-
Add an export command at the end of your profile script that's similar to the following example.
export PATH=~/.local/bin:$PATHThis command inserts the path,
~/.local/binin this example, at the front of the existingPATHvariable. -
Reload the profile into your current session to put those changes into effect.
$source ~/.bash_profile
-
-
To verify that
piporpip3is installed correctly, run the following command.$pip3 --versionpip 19.2.3 from ~/.local/lib/python3.7/site-packages (python 3.7)
Install and update the AWS CLI version 1 using pip
-
Use the
piporpip3command to install or update the AWS CLI. We recommend that if you use Python version 3 or later that you use thepip3command. The--userswitch,pipinstalls the AWS CLI to~/.local/bin.For the latest version of the AWS CLI, use the following command block:
$pip3 install awscli --upgrade --userFor a specific version of the AWS CLI, append a less-than symbol
<and the version number to the filename. For this example the filename for version1.16.312would be<1.16.312resulting in the following command:$pip3 install awscli<1.16.312--upgrade --user -
Verify that the AWS CLI installed correctly.
$aws --versionaws-cli/1.19.3 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x86_64 botocore/1.13If you get an error, see Troubleshooting AWS CLI errors.
Add the AWS CLI version 1 executable to your command line path
After installing with pip, you might need to add the aws
executable to your operating system' PATH environment variable.
You can verify which folder pip installed the AWS CLI in by running the
following command.
$which aws/home/username/.local/bin/aws
You can reference this as ~/.local/bin/ because
/home/username corresponds to ~ in Linux.
If you omitted the --user switch and so didn't install in user mode, the
executable might be in the bin folder of your Python installation. If
you don't know where Python is installed, run this command.
$which python/usr/local/bin/python
The output might be the path to a symlink, not to the actual executable. Run ls
-al to see where it points.
$ls -al /usr/local/bin/python/usr/local/bin/python -> ~/.local/Python/3.6/bin/python3.6
pip installs programs in the same folder that contains the Python
application. Add this folder to your PATH variable.
To modify your PATH variable
-
Find your shell's profile script in your user directory. If you're not sure which shell you have, run
echo $SHELL.$ls -a ~. .. .bash_logout .bash_profile .bashrc Desktop Documents Downloads-
Bash –
.bash_profile,.profile, or.bash_login -
Zsh –
.zshrc -
Tcsh –
.tcshrc,.cshrc, or.login
-
-
Add an export command to your profile script.
export PATH=~/.local/bin:$PATHThis command adds a path,
~/.local/binin this example, to the currentPATHvariable. -
Load the updated profile into your current session.
$source ~/.bash_profile
Uninstall the AWS CLI using pip
If you installed the AWS CLI using pip or pip3, you need to
uninstall the AWS CLI using the same package manager by running one of the following
commands.
$pip uninstall awscli
$pip3 uninstall awscli

