How to Install and Configure AWS CLI v2 on macOS: A Step-by-Step Guide
March 27, 2024
Date: March 27, 2024
Amazon Web Services (AWS) Command Line Interface (CLI) v2 brings a powerful tool to your macOS, enabling you to manage your AWS services directly from the terminal. Whether you’re updating to the latest version or setting it up for the first time, this guide will walk you through the process smoothly.
Step 1: Downloading AWS CLI v2 for macOS
Start by visiting the official AWS CLI website. Here, you'll find the macOS installer. Don't worry if you already have AWS CLI installed; running this installer will update you to the latest version.
Step 2: Installation
Once the download is complete, open the installer and follow the on-screen instructions. This process is straightforward and should take just a few minutes.
Step 3: Verifying the Installation
After installation, open your terminal and type aws --version
to check the installed version. As of this writing, the latest version is 2.15.33, but it could be higher depending on when you're installing.
Step 4: Setting Up Configuration Files
Next, navigate to /Users/[username]/.aws
to access or create the config
and credentials
files. If you're having trouble finding this folder in Finder, use the shortcut command+shift+.
in your home folder to reveal hidden files.
Config File
Inside the config
file, enter the following:
[default]
region = us-east-1
output = json
This sets your default region and output format.
Credentials File
In the credentials
file, add:
[default]
aws_access_key_id = YOUR_KEY_ID
aws_secret_access_key = YOUR_ACCESS_KEY
Replace YOUR_KEY_ID
and YOUR_ACCESS_KEY
with your actual AWS access key ID and secret access key, respectively. These can be obtained by creating an IAM User with programmatic access, as detailed in the AWS documentation.
Step 5: Checking Your Configuration
To ensure everything is set up correctly, run aws configure list
in your terminal. This command will display your current configuration settings.
By following these steps, you've successfully installed and configured AWS CLI v2 on your macOS. You're now ready to manage your AWS services more efficiently through the command line. For further customization and advanced features, consult the AWS CLI official documentation.