Install and Configure the AWS CLI

3 December 2025

The configuration is under windows system.

Prepare - Set up the Red Hat EC2 instance

  1. Download private key file

  2. Download and configure PuTTY

    • open PuTTY and choose Connection, set Seconds between keepalives to 30 to keep the PuTTY session open for a longer period of time
    • chosse Session and paste the public DNS of the Host instance
    • Back to Connection and expand SSH, choose Auth and select privite key file under Credentials, choose open
    • when prompted login as, enter: ec2-user(where to configure this) and tap Enter, then connect to the instance
  3. Verify python

    python3 --version
    
  4. unzip utility

    sudo yum install -y unzip
    
  5. download and install AWS CLI

    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
    unzip awscliv2.zip
    sudo ./aws/install
    
  6. verify CLI

    aws help
    

    type 1 to exit

  7. Connect to AWS account

    • return the active SSH session and enter aws configure to enter id and accesskey
    • AWS Access Key ID - AccessKey
    • AWS Secret Access Key - Secret access key
    • Default region name: e.g. us-east-1
    • Default output format: json
  8. observe IAM configuration details by using CLI

    aws iam list-users
    
    ---
    
    
    {
        "Users": [
            {
                "Path": "/",
                "UserName": "xxx",
                "UserId": "xxx",
                "Arn": "arn:aws:iam::xxx:user/xxx",
                "CreateDate": "2025-12-02T23:17:16+00:00"
            }
        ]
    }
    
    
  9. download the policy e.g. lab_policy json file

    aws iam get-policy-version \
    --policy-arn arn:aws:iam::xxx:policy/lab_policy \
    --version-id v1 \
    --query "PolicyVersion.Document" \
    --output json > lab_policy.json
    
    

© 2025 Sally Codes. All rights reserved.