AWS Developer Tools Blog

Installing and updating the AWS CLI with single-line commands

The AWS Command Line Interface v2 (AWS CLI) can now be installed and updated using single-line commands.

Previously, to install the AWS CLI, you had to download the correct installer for your platform and architecture, configure the installation path, and manually run the installer. To update the AWS CLI, you had to repeat the same installation steps.

To simplify these workflows, we released install scripts that automatically download, configure, and run official AWS CLI installers. We also released aws update, a new command that updates the current AWS CLI installation to the latest version.

In this post, you’ll learn to install the AWS CLI with an install script and update to the latest version with aws update. Before getting started, ensure your system meets the minimum requirements to use AWS CLI installers. See our documentation for details.

Installing

To install, use the following platform-specific guides to download and execute the install script.

macOS and Linux

Run the following command in a terminal. By default, the AWS CLI is installed for the current user in $HOME/.local/share/aws-cli and symlinks are created in $HOME/.local/bin.

curl -fsSL 'https://awscli.amazonaws.com/v2/install.sh' | bash

You can configure the user install location by setting the following environment variables:

  • XDG_DATA_HOME (default $HOME/.local/share/aws-cli)
  • XDG_BIN_HOME (default $HOME/.local/bin)

To install for all users system-wide, pass the script’s --system flag. This will install the AWS CLI in /usr/local/aws-cli and create symlinks in /usr/local/bin. Note that this requires root permissions.

curl -fsSL 'https://awscli.amazonaws.com/v2/install.sh' | sudo bash -s -- --system

Windows

Run the following command in PowerShell. By default, the AWS CLI is installed for the current user in %LOCALAPPDATA%\Programs\Amazon\AWSCLIV2.

irm 'https://awscli.amazonaws.com/v2/install.ps1' | iex

To install for all users system-wide, pass the script’s -System flag. This will install the AWS CLI in %ProgramW6432%\Amazon\AWSCLIV2. Note that this requires an elevated shell with administrator privileges.

irm 'https://awscli.amazonaws.com/v2/install.ps1' -OutFile install.ps1; try { .\install.ps1 -System } finally { Remove-Item install.ps1 }

Updating

Starting with version 2.36.0, you can upgrade to the latest AWS CLI version by running aws update. The update command detects and reuses the current AWS CLI installation path.

aws update is supported only for installations managed by an official installer, install script, or the update command itself.

Conclusion

We’ve made it easier to install the AWS CLI using install scripts and upgrade to the latest version using the aws update command. We recommend that you use these new tools instead of the installers to get started faster. To learn more, visit our docs on installing and updating the AWS CLI.

Please share your questions, comments, and issues with us on GitHub.

TAGS: ,
Steve Yoo

Steve Yoo

Steve is a Software Development Engineer on the AWS CLI team. You can find him on GitHub @hssyoo.