# Getting Started with AWS CLI

# Getting Started with AWS CLI: A Step-by-Step Guide

The AWS Command Line Interface (CLI) is a powerful tool that allows you to interact with AWS services directly from your terminal or command prompt. Setting up the AWS CLI is a straightforward process, and this guide will walk you through each step to ensure a smooth setup.

## Prerequisites

Before you begin, make sure you have the following prerequisites:

1. An AWS account: You need an active AWS account to access AWS services.
2. Terminal or Command Prompt: Ensure you have a terminal (Linux/Mac) or command prompt (Windows) available.

## Step 1: Install the AWS CLI

The first step is to install the AWS CLI on your machine. The AWS CLI is compatible with various operating systems, including Windows, macOS, and Linux.

### Install on Linux/Mac:

```bash
# On Linux/Mac, you can use the package manager
curl "https://d1vvhvl2y92vvt.cloudfront.net/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install
```

### Install on Windows:

Download and run the AWS [CLI installer for Windows](https://awscli.amazonaws.com/AWSCLIV2.msi)

After installation, you can verify it by running:

```bash
aws --version
```
This should display the installed AWS CLI version.

## Step 2: Configure the AWS CLI

Once the AWS CLI is installed, you need to configure it with your AWS credentials. Run the following command:

```bash
aws configure
```

This command will prompt you to enter the following information:
- AWS Access Key ID: Your AWS access key.
- AWS Secret Access Key: Your AWS secret key.
- Default region name: The AWS region you want to use by default (e.g., us-east-1).
- Default output format: The format in which AWS CLI should display output (e.g., json).

After entering these details, your AWS CLI is configured and ready to use.

## Step 3: Verify the Configuration

To ensure that your AWS CLI is set up correctly, you can run a simple command to list your S3 buckets. Use the following command:

```bash
aws s3 ls
```
This command should display a list of your S3 buckets if your credentials and configuration are correct.

## Additional Configuration Options

### Multiple Profiles:

If you have multiple AWS accounts, you can configure named profiles for each account:

```bash
aws configure --profile profile-name
```
### Using AWS CLI with IAM Roles:

If you are running AWS CLI commands on an EC2 instance, consider using IAM roles and temporary credentials:

```bash
aws configure set aws_session_token <SESSION_TOKEN>
```
## Conclusion

Setting up the AWS CLI is a crucial step for interacting with AWS services from the command line. With this guide, you should have a fully configured AWS CLI environment, ready to explore and manage your AWS resources efficiently. Whether you're a developer, system administrator, or DevOps engineer, the AWS CLI is an indispensable tool in your AWS toolkit. Happy coding!
