How Install and Configure the AWS CLI on Windows Terminal
Oyoh Edmond
Posted on November 15, 2023
Lab overview
The AWS Command Line Interface (AWS CLI) is a command line tool that provides an interface for interacting with products and services from Amazon Web Services (AWS).
You can install the AWS CLI on your local machine or a virtual machine such as an Amazon Elastic Compute Cloud (Amazon EC2) instance.
In this activity, you install and configure the AWS CLI on a Red Hat Linux instance because this instance type does not have the AWS CLI pre-installed. Some instance types, such as Amazon Linux, do come pre-installed with the AWS CLI.
During this activity, you establish a Secure Shell (SSH) connection to the instance. You configure the installation with an access key that can connect to an AWS account. Finally, you practice using the AWS CLI to interact with AWS Identity and Access Management (IAM).
When you finish the activity, it will reflect the following diagram:
In the preceding diagram, you can access the AWS Cloud through an SSH connection. Within the AWS Cloud, a virtual private cloud (VPC) with a Red Hat EC2 instance is configured with the AWS CLI. IAM is configured, and you use the AWS CLI to interact with IAM.
Objectives
Install and configure the AWS CLI.
Connect the AWS CLI to an AWS account.
Access IAM by using the AWS CLI.
Accessing the AWS Management Console
Based on the task given, a lab was provided.
Connect to the Red Hat EC2 instance by using SSH
In this task, an EC2 instance was already in existence.
As a Windows user, PuTTy was recommended for usage.
PuTTY is an SSH and telnet client, developed originally by Simon Tatham for the Windows platform.
Download PuTTY to use an SSH utility to connect to the EC2 instance. If you do not have PuTTY installed on your computer, download it.
A private key (.ppk format) was provided based on the already existing EC2 instance created.
- A Public IP was provided based on the already existing EC2 instance created.
After downloading PuTTY, Open PuTTy.exe
-
Configure the PuTTY timeout to keep the PuTTY session open for a longer period of time:
- Choose Connection.
- For Seconds between keepalives, enter 30.
-
Configure your PuTTY session:
- Choose Session.
- For the Host Name (or IP address), enter the PublicIP address that you copied from the previous steps.
- In PuTTY in the Connection list, choose SSH to expand it.
- Choose Auth, then choose Credentials
- Choose Browse.
- Browse and select the Private key file that you downloaded.
- To choose the file, choose Open.
- Choose Open again.
Finally, click Open.
When prompted with login as, enter ec2-user and press Enter.
This step connects you to the EC2 instance.
Install the AWS CLI on a Red Hat Linux instance
From the terminal window to install the AWS CLI on a Red Hat Linux instance.
- To write the downloaded file to the current directory, run the following curl command with the -o option:
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
- To unzip the installer, run the following unzip command with the -u option. In this command, the unzip command prompts you to overwrite any existing files. To skip these prompts, the command includes the -u option.
unzip -u awscliv2.zip
- To run the install program, run the following command. This sudo command grants write permissions to the directory. The installation command in the code snippet uses a file named install in the unzipped AWS directory to install the AWS CLI.
sudo ./aws/install
- To confirm the installation, run the following command:
aws --version
- The following is an example of the output:
aws-cli/2.13.35 Python/3.11.6 Linux/4.14.327-246.539.amzn2.x86_64 exe/x86_64.amzn.2 prompt/off
Note: The version numbers that are installed change over time and might not reflect this example.
- To verify that the AWS CLI is now working, run the following AWS help command. The help command displays the information for the AWS CLI.
aws help
- At the: prompt, enter q to exit.
Configure the AWS CLI to connect to your AWS Account
- In the SSH session terminal window, run the configure command for the AWS CLI:
aws configure
-
At the prompt, configure the following:
The following below was provided as a result of the existing Ec2 instance.- AWS Access Key ID: Copy and paste the AccessKey value into the terminal window.
- AWS Secret Access Key: Copy and paste the SecretKey value into the terminal window.
- Default region name: Enter us-west-2
- Default output format: Enter json
- In the terminal window, test the IAM configuration by running the following command:
aws iam list-users
Fellow me for more practical steps
Posted on November 15, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.