profile-picture

Dominic Johnson

Software Developer

TwitterGithubLinkedinYouTube

How to download and configure aws cli

June 23, 2024 (4mo ago)

This is a quick walk through on how to get started with the AWS Cli. Using their Cli or Terraform are the recommended ways to interact with your aws services.

Getting Started

Amazon Web Services (AWS) Command Line Interface (CLI) is a powerful tool that allows users to interact with AWS services directly from their command-line interface. By using AWS CLI, you can efficiently manage AWS resources, automate tasks, and streamline your workflow. In this blog article, we will walk you through the step-by-step process of downloading and configuring AWS CLI on your system.

Step 1: Prerequisites

Before we dive into the installation process, make sure you have the following prerequisites:

  1. An AWS account: If you don't have one, you can create a free-tier account on the AWS website.

  2. Operating System: AWS CLI is compatible with various operating systems, including Windows, macOS, and Linux. Ensure that you have one of these operating systems installed on your machine.

Step 2: Download AWS CLI

The installation process varies depending on your operating system:

For Windows:

  1. Visit the AWS CLI official page: https://aws.amazon.com/cli/
  2. Click on the "AWS CLI version 2.x" link to download the Windows Installer.
  3. Once downloaded, run the installer and follow the on-screen instructions to complete the installation.

For macOS:

  1. Open the Terminal application.
  2. Use the following command to download the AWS CLI package:
    curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"
  3. Once the download is complete, run the following command to install AWS CLI:
    sudo installer -pkg AWSCLIV2.pkg -target /

For Linux:

  1. Open the Terminal or command prompt.
  2. Download the AWS CLI bundle using the following command:
    curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
  3. Unzip the downloaded file:
    unzip awscliv2.zip
  4. Run the installation script:
    sudo ./aws/install

Step 3: Verify the Installation

After the installation is complete, you can verify that AWS CLI is correctly installed by opening a new terminal or command prompt and typing:

console.log("welcome home")
aws --version

This command will display the installed version of AWS CLI, confirming that the installation was successful.

Step 4: Configure AWS CLI

Now that AWS CLI is installed, the next step is to configure it to interact with your AWS account. Follow these steps to configure AWS CLI:

  1. Open a terminal or command prompt.

  2. Type the following command and provide your AWS Access Key ID, Secret Access Key, default region, and default output format (JSON or text) when prompted:

    aws configure

    You can find your Access Key ID and Secret Access Key in the AWS Management Console under "My Security Credentials" in the "IAM" section.

  3. After providing the required information, AWS CLI will create a configuration file in your home directory (~/.aws/credentials) containing the access credentials.

Step 5: Test the Configuration

To ensure that AWS CLI is correctly configured, run a simple command to list your AWS S3 buckets:

aws s3 ls

If everything is set up correctly, this command will display a list of your S3 buckets.

Conclusion

You have successfully downloaded and configured AWS CLI on your system. With AWS CLI, you can now interact with various AWS services efficiently from the command line, enabling you to automate tasks and streamline your AWS operations. By mastering this powerful tool, you'll be better equipped to manage your AWS resources effectively and make the most of your cloud infrastructure. Happy cloud computing!

© 2024 Dominic Johnson