Kubernetes Mastery

Develop and Deploy Cloud Native Applications at Scale

Setting up AWS CLI (Mac)

This guide will walk you through the process of installing and configuring the AWS Command Line Interface (CLI) on macOS.

Installing AWS CLI

  1. Download the AWS CLI pkg installer for macOS from the official AWS CLI website.

  2. Run the downloaded pkg installer and follow the on-screen instructions.

  3. After installation, open a new Terminal window to ensure the PATH is updated.

  4. To verify that AWS CLI is installed correctly, open a new terminal (macOS) window, and run the following command: aws --version

  5. You should see output similar to:

    aws-cli/2.x.y Python/3.x.y OS_NAME x86_64 OS_VERSION
    

Configuring AWS CLI

  1. Open a Terminal window.

  2. Run the following command:

    aws configure
    
  3. You'll be prompted to enter four pieces of information:

    • AWS Access Key ID: Enter the access key from your IAM user
    • AWS Secret Access Key: Enter the secret key from your IAM user
    • Default region name: Go to this page aws regions and find the region closest to your users. Since this is a tutorial, choose and enter us-east-1 (AWS's oldest and most feature-complete region).
    • Default output format: Choose from json, yaml, text, table (json is recommended)

Verifying Configuration

To verify that AWS CLI is configured correctly:

  1. Run the following command:
aws configure list
  1. You should see output similar to:
   Name                    Value             Type    Location
   ----                    -----             ----    --------
profile                <not set>             None    None
access_key     ****************ABCD      shared-credentials-file
secret_key     ****************EFGH      shared-credentials-file
region                us-west-2              config-file    ~/.aws/config

Note: The access key and secret key will be partially hidden for security reasons.

Testing AWS CLI

To test if AWS CLI is working correctly:

  1. Run a simple AWS command, such as listing your S3 buckets (Amazon storage service for objects) :

    aws s3 ls
    
  2. If configured correctly, you'll either see a list of S3 buckets or an empty response if you have no buckets.

By following these steps, you've successfully installed and configured the AWS CLI on your system. You can now use AWS services through the command line interface.