
Getting Started with the AWS CLI

AWS CLI Installation Guide
This guide walks you through installing and configuring the AWS Command Line Interface (CLI) on your system.
Prerequisites
Make sure you have:
- Python (3.8 or later)
- pip (the Python package installer)
Step 1: Installing the AWS CLI
To install the AWS CLI using pip, run:
1 | python -m pip install awscli |
For a system-wide installation, use:
1 | sudo python -m pip install awscli |
To install for your user only, use:
1 | python -m pip install --user awscli |
Alternative Installations:
For macOS:
Download and run the installer directly from AWS:
1 | curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" |
For Windows:
Download the MSI installer from the AWS CLI website and follow the installation prompts.
For Linux:
1 | sudo apt install awscli |
Step 2: Verifying the Installation
To confirm that the AWS CLI is installed, run:
1 | aws --version |
This should display the version number of the AWS CLI installed on your system.
Step 3: Configuring the AWS CLI
Run the following command to set up your AWS credentials and default settings:
1 | aws configure |
Alternate Configuration Options
You can also configure AWS credentials using environment variables or by editing the configuration files in ~/.aws/.
Environment Variables:
Set credentials in the shell for temporary configuration:
1 | export AWS_ACCESS_KEY_ID=<access_key> |
Shared Credentials File:
You can store your AWS credentials in a shared credentials file. Create or edit the file located at ~/.aws/credentials, and format it as follows:
1 | [default] |
To view the details of the Current IAM Identity
This command retrieves the AWS account ID, IAM user or role ID, and ARN for the currently authenticated identity.
1 | aws sts get-caller-identity |
If you have configured using –profile option to configure then
1 | aws sts get-caller-identity --profile AWS |
Our output will be something like this:
1 | aws sts get-caller-identity --profile AWS |
Stay tuned for more write-ups on cloud security challenges from PwnedLabs!
- Title: Getting Started with the AWS CLI
- Author: Sebin Thomas
- Created at : 2024-11-01 17:29:00
- Updated at : 2025-02-24 21:01:48
- Link: https://0xsebin-blogs.vercel.app//Getting-Started-with-the-AWS-CLI
- License: All Rights Reserved © Sebin Thomas