Installing AWS CLI version 2 on Windows/ Linux

By default, the eG agent connects to the target Amazon Connect using AWS CLI application to collect the metrics. The AWS Command Line Interface (AWS CLI) is an open-source tool that enables you to interact with AWS services using commands in your command-line shell.

With minimal configuration, the AWS CLI enables you to start running commands that implement functionality equivalent to that provided by the browser-based AWS Management Console from the command prompt in your terminal program:

  • Linux shells – Use common shell programs such as bash, zsh, and tcsh to run commands in Linux or macOS.

  • Windows command line – On Windows, run commands at the Windows command prompt or in PowerShell.

  • Remotely – Run commands on Amazon Elastic Compute Cloud (Amazon EC2) instances through a remote terminal program such as PuTTY or SSH, or with AWS Systems Manager.

Steps to Install AWS CLI version 2 on a Windows Host

Before you install the AWS CLI version 2 on a Windows host, ensure the following:

  • A 64-bit version of Windows host

  • Administrator rights to install software

Follow the steps mentined below to install the AWS CLI version 2 on a Windows host using the MSI installer:

  1. Download the AWS CLI MSI installer for Windows (64-bit):

    • For the latest version of the AWS CLI: https://awscli.amazonaws.com/AWSCLIV2.msi

    • For a specific version of the AWS CLI: Append a hyphen and the version number to the filename. For example, the filename for version 2.0.30 would be AWSCLIV2-2.0.30.msi resulting in the following link https://awscli.amazonaws.com/AWSCLIV2-2.0.30.msi. For a list of versions, see the AWS CLI version 2 changelog on GitHub.

      To update your current installation of AWS CLI version 2 on a Windows host, download a new installer each time you update to overwrite previous versions. AWS CLI is updated regularly. To see when the latest version was released, see the AWS CLI version 2 changelog on GitHub.

  2. Run the downloaded MSI installer and follow the on-screen instructions. By default, the AWS CLI installs to C:\Program Files\Amazon\AWSCLIV2.

  3. To confirm the installation, open the Start menu, search for cmd to open a command prompt window, and at the command prompt use the aws --version command.

    Don't include the prompt symbol (C:\>) when you type a command. These are included in program listings to differentiate commands that you type from output returned by the AWS CLI. The rest of this guide uses the generic prompt symbol ($), except in cases where a command is Windows-specific.

    C:\> aws --version

    aws-cli/2.1.29 Python/3.7.4 Windows/10 botocore/2.0.0

    If Windows is unable to find the program, you might need to close and reopen the command prompt window to refresh the path, or add the installation directory to your PATH environment variable manually.

Steps to Install AWS CLI version 2 on a Linux Host

Before you install the AWS CLI version 2 on a Linux host, find the pre- requisites below:

  • You must be able to extract or "unzip" the downloaded package. If your operating system doesn't have the built-in unzip command, use an equivalent.

  • The AWS CLI version 2 uses glibc, groff, and less. These are included by default in most major distributions of Linux.

  • The AWS CLI version 2 on 64-bit versions of recent distributions of CentOS, Fedora, Ubuntu, Amazon Linux 1, and Amazon Linux 2 is supported.

  • The AWS CLI version 2 on 64-bit Linux ARM is supported.

  • Since AWS doesn't maintain third-party repositories, there is no guarantee that they contain the latest version of the AWS CLI.

Install the AWS CLI version 2 on a Linux host, by following the steps below:

We provide the steps in one easy to copy and paste group based on whether you use 64-bit Linux or Linux ARM. See the descriptions of each line in the steps that follow.

  • Linux x86 (64-bit)

  • Linux ARM

For the latest version of the AWS CLI, use the following command block:

$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

unzip awscliv2.zip

sudo ./aws/install

For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For example the filename for version 2.0.30 would be awscli-exe-linux-x86_64-2.0.30.zip resulting in the following command:

$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"

unzip awscliv2.zip

sudo ./aws/install

For a list of versions, see the AWS CLI version 2 changelog on GitHub.

  1. Download the installation file in one of the following ways:

    • Use the curl command – The -o option specifies the file name that the downloaded package is written to. The options on the following example command write the downloaded file to the current directory with the local name awscliv2.zip.

      • Linux x86 (64-bit)

      • Linux ARM

        For the current version of the AWS CLI, use the following command:

        $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

        For a specific version of the AWS CLI, append a hyphen and the version number to the filename. For example the filename for version 2.0.30 would be awscli-exe-linux-x86_64-2.0.30.zip resulting in the following command:

        $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.0.30.zip" -o "awscliv2.zip"

    • Downloading from the URL – To download the installer with your browser, use one of the following URLs. You can verify the integrity and authenticity of your downloaded installation file before you extract (unzip) the package.

  2. Unzip the installer. If your Linux distribution doesn't have a built-in unzip command, use an equivalent to unzip it. The following example command unzips the package and creates a directory named aws under the current directory.

    $ unzip awscliv2.zip

  3. Run the install program. The installation command uses a file named install in the newly unzipped aws directory. By default, the files are all installed to /usr/local/aws-cli, and a symbolic link is created in /usr/local/bin. The command includes sudo to grant write permissions to those directories.

    $ sudo ./aws/install

    You can install without sudo if you specify directories that you already have write permissions to. Use the following instructions for the install command to specify the installation location:

    • Ensure that the paths you provide to the -i and -b parameters contain no volume name or directory names that contain any space characters or other white space characters. If there is a space, the installation fails.

    • --install-dir or -i – This option specifies the directory to copy all of the files to.

      The default value is /usr/local/aws-cli.

    • --bin-dir or -b – This option specifies that the main aws program in the install directory is symbolically linked to the file aws in the specified path. You must have write permissions to the specified directory. Creating a symlink to a directory that is already in your path eliminates the need to add the install directory to the user's $PATH variable.

      The default value is /usr/local/bin.

      $ ./aws/install -i /usr/local/aws-cli -b /usr/local/bin

  4. Confirm the installation.

  5. $ aws --version

    aws-cli/2.1.29 Python/3.7.4 Linux/4.14.133-113.105.amzn2.x86_64 botocore/2.0.0