Install and Configure the AWS CLI
3 December 2025
The configuration is under windows system.
Prepare - Set up the Red Hat EC2 instance
-
Download private key file
-
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
-
Verify python
python3 --version -
unzip utility
sudo yum install -y unzip -
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 -
verify CLI
aws helptype 1 to exit
-
Connect to AWS account
- return the active SSH session and enter
aws configureto 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
- return the active SSH session and enter
-
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" } ] } -
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