How to install AWS CLI on CentOS or Red Hat

Installing AWS CLI on CentOS Stream or Red Hat Enterprise Linux (RHEL) provides a direct shell interface for provisioning, identity checks, storage operations, and scripted AWS automation without depending on the web console for routine work.

For a distro-specific guide, the package-manager route comes first when the awscli package is available through the configured DNF repositories. That keeps installation, upgrades, and removal under normal RPM ownership and fits the way most CentOS Stream, Rocky, Alma, and subscription-managed RHEL hosts are maintained.

Repository availability depends on the exact distribution and enabled repositories. On Rocky Linux 9, enabling EPEL currently exposes awscli 1.29.62 through DNF. On other RHEL builds, use the package if it is present in the enabled repositories allowed by the local support policy; if not, fall back to the official AWS CLI v2 installer instead of pretending the RPM route exists everywhere.

Steps to install AWS CLI on CentOS or Red Hat:

  1. Check whether the configured DNF repositories already provide the awscli package.
    $ sudo dnf info awscli
    Last metadata expiration check: 0:00:02 ago on Sat Mar 28 23:55:18 2026.
    Available Packages
    Name         : awscli
    Version      : 1.29.62
    Release      : 1.el9
    Architecture : noarch
    Repository   : epel

    If DNF reports No matching Packages to list, enable the repository set allowed on that host and recheck. On Rocky, Alma, and many CentOS Stream-compatible builds, EPEL is a common source for awscli.

  2. Enable EPEL on compatible builds when the package is not yet available through the current repositories.
    $ sudo dnf install --assumeyes epel-release

    On subscription-managed RHEL systems, only enable repositories that match the local support and compliance policy. If awscli still remains unavailable after the permitted repositories are enabled, switch to the official AWS CLI v2 installer instead of forcing the RPM path.

  3. Install the packaged AWS CLI with DNF.
    $ sudo dnf install --assumeyes awscli

    The installed major version depends on the package carried by the enabled repositories.

  4. Verify that the shell resolves the packaged binary and reports a working version.
    $ command -v aws
    /usr/bin/aws
    $ aws --version
    aws-cli/1.29.62 Python/3.9.18 Linux/5.14.0-570.el9.x86_64 botocore/1.31.62

    The exact version varies by distribution and enabled repositories. The decisive check is that aws resolves from the packaged system path and reports the version that matches the installed RPM.

  5. Run a simple signed request after configuration to confirm that the installed CLI can reach AWS with the intended identity.
    $ aws sts get-caller-identity
    {
        "UserId": "AIDASAMPLEUSERID",
        "Account": "123456789012",
        "Arn": "arn:aws:iam::123456789012:user/PlatformOperator"
    }