How to install AWS CLI on CentOS Stream or Red Hat Enterprise Linux

Installing AWS CLI on CentOS Stream or Red Hat Enterprise Linux (RHEL) puts AWS identity checks, S3 transfers, and repeatable service calls directly into the shell for local administration and automation work.

Current AWS guidance for Linux is the bundled AWS CLI version 2 installer rather than a third-party DNF repository. The archive unpacks a self-contained install program that places the CLI under /usr/local/aws-cli and creates the aws command at /usr/local/bin/aws.

Current CentOS Stream and RHEL minimal images usually already provide a working curl command through curl-minimal, so the main missing prerequisite is usually unzip. Stripped-down hosts can also fail on aws help until groff is installed, and ARM64 systems must use the Linux aarch64 archive instead of the x86_64 file shown below.

Steps to install AWS CLI on CentOS Stream or Red Hat Enterprise Linux:

  1. Install unzip and groff with DNF.
    $ sudo dnf install --assumeyes unzip groff

    Current CentOS Stream and RHEL minimal installs usually already provide a working curl command through curl-minimal. If the next step reports that curl is missing, install the distribution's curl package before continuing.

    The AWS CLI installs without groff, but current minimal RHEL-family builds can return Could not find executable named "groff or mandoc" when aws help runs without it.

  2. Download the current AWS CLI version 2 archive for 64-bit x86_64 Linux.
    $ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

    Use https://awscli.amazonaws.com/awscli-exe-linux-aarch64.zip on ARM64 systems.

  3. Extract the installer archive in the current working directory.
    $ unzip awscliv2.zip
  4. Run the bundled installer with sudo.
    $ sudo ./aws/install
    You can now run: /usr/local/bin/aws --version

    The default install location is /usr/local/aws-cli and the default symlink is /usr/local/bin/aws.

    If /usr/local/aws-cli already contains a manual AWS CLI v2 install, rerun the installer with sudo ./aws/install --update to replace it in place.

  5. Confirm that the shell resolves the bundled binary.
    $ command -v aws
    /usr/local/bin/aws

    If the shell still resolves /usr/bin/aws, remove the older awscli package with sudo dnf remove --assumeyes awscli before retrying.

  6. Print the installed version and stop when the first token starts with aws-cli/2.
    $ aws --version
    aws-cli/2.34.32 ##### snipped #####

    The remaining runtime and platform fields vary by release and host. The decisive result is that the line starts with aws-cli/2.

  7. Run a signed request after credentials are configured to confirm that the new install can authenticate to AWS.
    $ aws sts get-caller-identity
    {
        "UserId": "AIDASAMPLEUSERID",
        "Account": "123456789012",
        "Arn": "arn:aws:iam::123456789012:user/PlatformOperator"
    }

    Configure credentials first with aws configure, aws configure sso, or aws login on a fresh host.

  8. Remove the downloaded installer files after the CLI is working.
    $ rm -r aws awscliv2.zip

    Removing these temporary files does not uninstall AWS CLI from /usr/local/aws-cli.