-
Notifications
You must be signed in to change notification settings - Fork 254
Description
Outline 7. AWS CLI Configuration
AWS CLI Configuration
This guide walks you through configuring the AWS CLI after generating your access key and secret access key. With the AWS CLI properly configured, you’ll be able to manage your AWS services directly from the command line.
Table of Contents
Overview
After creating an AWS user and generating access keys, the next step is to configure the AWS CLI. This allows you to interact with your AWS resources programmatically and run commands for services like S3, EC2, and more.
Prerequisites
- An AWS user with valid access key and secret access key.
- A working terminal on MacOS (or your preferred platform).
- (Optional) Homebrew installed for package management on MacOS.
Step-by-Step Configuration
1. Installing the AWS CLI
If you haven’t installed the AWS CLI yet, you can do so using Homebrew on MacOS:
brew install awscli2. Configuring the AWS CLI
Run the following command to set up your AWS CLI credentials and configuration:
aws configureDuring the configuration, you will be prompted for the following details:
- AWS Access Key ID: Enter your access key.
- AWS Secret Access Key: Enter your secret access key.
- Default region name: Specify the region your account uses (you can find the current region in the top-right corner of the AWS Management Console, e.g., N. Virginia (us-east-1)).
- Default output format: Leave this blank to use the default JSON format.
3. Verifying the Configuration
After completing the configuration, verify your settings by running:
aws configure listThe AWS CLI stores the credentials in the ~/.aws/credentials file and the configuration settings in the ~/.aws/config file.
Testing Your Configuration
Test your AWS CLI setup by listing your S3 buckets:
aws s3 lsExpected outcomes:
- Successful configuration: The command will list your S3 buckets.
- Access Denied / No Buckets:
An "Access Denied" error or an empty response (no buckets) is an expected outcome if your account does not have any S3 buckets or lacks permission for that specific operation. This outcome confirms that your CLI connection is set up correctly. - Authenticator Issues:
If you encounter errors related to authentication (such as invalid credentials or signature mismatches), this indicates a bad CLI configuration. In other words, an authenticator issue signals that your AWS Access Key ID and Secret Access Key may be misconfigured or entered incorrectly.
Next Steps in the Series
In the upcoming section of this AWS deployment series, we’ll focus on building Docker images using Docker Compose, setting up an image repository on AWS Elastic Container Registry (ECR), and pushing our locally built images to AWS. These steps will prepare your containers for deployment on AWS services such as Fargate.