setup-aws-cli

How to Set Up AWS CLI

The AWS Command Line Interface (CLI) is a powerful tool that lets you control AWS services using terminal commands. Once installed and configured properly, you will be able to do tasks like create resources, manage settings, and automate tasks without logging into the AWS Console. 

But how do you actually set it up?

This guide walks you through the process of setting up the AWS CLI on your machine to do all of that.

How to set up AWS CLI

Step 1: Install AWS CLI

Install the latest version of AWS CLI for your operating system. AWS CLI version 2 is the latest version at the time of writing this guide. Here’s how you can do it, depending on your operating system:

  • Windows:
    Download the installer from:
    https://awscli.amazonaws.com/AWSCLIV2.msi
    Run the installer and follow the prompts.


  • macOS:
    Download and install using the following command:
    curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg"

sudo installer -pkg AWSCLIV2.pkg -target /


  • Linux:
    Use the following command to download and install:

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"

unzip awscliv2.zip

sudo ./aws/install

After installation, you can verify if the installation was successful using the following command:

aws --version

You should see something like:
aws-cli/2.x.x Python/3.x.x ...

Step 2: Get AWS Access Key and Secret Key

You’ll need these credentials to connect your CLI to your AWS account. To access these, log in to the AWS Console, navigate to IAM, then select Users, and click on your username. Under the Security credentials tab, click on Create access key and then save your Access key ID and Secret access key securely

Step 3: Configure AWS CLI

Now, go to the terminal and run the following command in your terminal:

aws configure

You’ll be prompted to enter:

  • AWS Access Key ID

  • AWS Secret Access Key

  • Default region name

  • Default output format


Enter the details here as shown below:

AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE

AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY

Default region name [None]: us-east-1

Default output format [None]: json

Once done, the CLI will save your settings in ~/.aws/config and ~/.aws/credentials.

Step 4: Test the configuration

Run a simple command to verify it’s working:

aws s3 ls

If your credentials and region are correct, this command will list your S3 buckets (if any). So, you might see something like this:

2025-06-30 10:12:00  my-sample-bucket

2025-06-30 10:15:27  company-static-site



Pump saves ~60% on CLOUD *for free*

FAQ

Get started with PUMP for free

No contracts, no credit card needed to sign up

Get started with PUMP for free

No contracts, no credit card needed to sign up

Get started with PUMP for free

No contracts, no credit card needed to sign up

1390 Market Street, San Francisco, CA 94102

Made with

in San Francisco, CA

© All rights reserved. Pump Billing, Inc.