AWS CLI Installation Guide for Ubuntu
This guide provides instructions for installing the AWS Command Line Interface (AWS CLI) on Ubuntu machines.
Installation Methods
There are two primary methods to install AWS CLI:
-
Command Line Installer (Recommended for version control)
- Allows specific version installation
- Manual updates required
- Good for teams that need to pin versions
-
Snap Package
- Automatically updates to the latest version
- No version selection support
- Good for users who want to stay current
Installation Using Command Line Installer
Prerequisites
- Ubuntu machine (x86 64-bit)
curlinstalledunziputility installed- Sudo privileges
Basic Installation Steps
- Download the AWS CLI package:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"- Unzip the installer:
unzip awscliv2.zip- Run the install program:
sudo ./aws/installUpdating Existing Installation
To update your current AWS CLI installation:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --updateCustom Installation Location
You can specify custom installation directories using these parameters:
--install-diror-i: Directory for AWS CLI files--bin-diror-b: Directory for symlinks to AWS CLI program
Example:
./aws/install -i /usr/local/aws-cli -b /usr/local/binNote: Ensure paths contain no spaces or special characters.
Verification
Verify the installation by checking the AWS CLI version:
aws --versionExpected output format:
aws-cli/2.x.x Python/3.x.x Linux/x.x.x botocore/2.x.xTroubleshooting
If the aws command is not found after installation:
- Restart your terminal
- Verify the installation path is in your system's PATH variable
- Check if the symlink was created correctly in
/usr/local/bin
Additional Notes
- The default installation location is
/usr/local/aws-cli - The default symlink location is
/usr/local/bin - When updating, use the
-uflag with unzip to automatically overwrite existing files:unzip -u awscliv2.zip