On a Linux system, curl can be used to download the latest version of the AWS CLI.
curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip --output /tmp/awscliv2.zip
Or, you can download a specific version of the AWS CLI (version 2.13.24 in this example).
curl https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.13.24.zip --output /tmp/awscli-exe-linux-x86_64-2.13.24.zip
Or the following for version 1.x.x of the AWS CLI.
curl https://s3.amazonaws.com/aws-cli/awscli-bundle-1.16.312.zip --output /tmp/awscli-bundle-1.16.312.zip
Create a temporary directory for the AWS CLI installation files.
mkdir /tmp/aws-cli-2.13.24-install-files
unzip the file.
unzip /tmp/awscliv2.zip -d /tmp/aws-cli-2.13.24-install-files
You can now delete the .zip file.
rm /tmp/awscliv2.zip
Update the install and aws commands to be executable.
chmod +x /tmp/aws/install
chmod +x /tmp/aws/dist/aws
The install command can then be used to install the CLI.
/tmp/aws/install
By default, the AWS CLI will be installed in the /usr/local/aws-cli/v2/<version> directory, with three sub-directories, bin, current and dist.
├── usr
│ ├── local
│ │ ├── aws-cli
│ │ │ ├── v2
│ │ │ │ ├── bin
│ │ │ │ ├── current
│ │ │ │ ├── dist
Likewise, the /usr/local/bin/aws should be a symbolic link to /usr/local/aws-cli/v2/<version>/current.
~]$ ls -l /usr/local/aws-cli/v2
drwxr-xr-x. 4 root root 29 Feb 11 2022 2.4.18
lrwxrwxrwx. 1 root root 28 Feb 11 2022 current -> /usr/local/aws-cli/v2/2.4.18
Or the --install-dir and --bin-dir options can be used to install the AWS CLI is a specific directory, usually your users home directory, for testing/debugging purposes.
/tmp/aws/install --install-dir ~/.local/aws_v2.13.24/aws-cli --bin-dir ~/.local/aws_v2.13.24/bin
You can now remove the /tmp/aws install directory.
rm -rf /tmp/awscli-2.13.24-install
Did you find this article helpful?
If so, consider buying me a coffee over at 