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 | |
For a system-wide installation, use:
1 | |
To install for your user only, use:
1 | |
Alternative Installations:
For macOS:
Download and run the installer directly from AWS:
1 | |
For Windows:
Download the MSI installer from the AWS CLI website and follow the installation prompts.
For Linux:
1 | |
Step 2: Verifying the Installation
To confirm that the AWS CLI is installed, run:
1 | |
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 | |
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 | |
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 | |
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 | |
If you have configured using –profile option to configure then
1 | |
Our output will be something like this:
1 | |