"aws configure" simple creates the credential file for you on your workstation or server in the file %USERPROFILE%\.aws\credentials. You type the credentials in, it puts them into the file on the local server. As far as I know it doesn't do anything else with the credentials.

You can edit it directly to do exactly the same thing. It's a regular file, holding AWS access key and secret keys.

In terms of security, having your credentials stored in a file on a workstation / server unencrypted isn't ideal. If your computer gets a virus or ransomware they could be lost or stolen. If this ever happens you should remove those keys in the AWS console and issue new keys once your machine is sufficiently secure again.

IMHO the risk is worthwhile if you need to use the AWS CLI, so long as your machine has good security practices. Basics like a firewall, virus / malware scanner, etc.

Answer from Tim on serverfault.com
🌐
Amazon Web Services
docs.aws.amazon.com › cli › latest › reference › configure
configure — AWS CLI 2.34.40 Command Reference
First time using the AWS CLI? See the User Guide for help getting started. ... Configure AWS CLI options. If this command is run with no arguments, you will be prompted for configuration values such as your AWS Access Key Id and your AWS Secret Access Key. You can configure a named profile using the --profile argument.
🌐
Amazon Web Services
docs.aws.amazon.com › aws command line interface › user guide for version 2 › getting started with the aws cli › setting up the aws cli
Setting up the AWS CLI - AWS Command Line Interface
February 27, 2026 - For general use, the aws configure or aws configure sso commands in your preferred terminal are the fastest way to set up your AWS CLI installation. Based on the credential method you prefer, the AWS CLI prompts you for the relevant information.
🌐
Amazon Web Services
aws.amazon.com › products › management and governance › aws config
AWS Config – Amazon Web Services
2 days ago - AWS Config is a config tool that helps you assess, audit, and evaluate the configurations and relationships of your resources.
🌐
Amazon Web Services
docs.aws.amazon.com › cli › latest › reference › configure › set.html
set — AWS CLI 2.34.38 Command Reference
The aws configure set command can be used to set a single configuration value in the AWS config file.
🌐
DEV Community
dev.to › aws-builders › the-easiest-way-to-set-up-and-configure-your-aws-cli-5g08
The easiest way to set up and configure your AWS CLI - DEV Community
February 1, 2025 - step by step guide to configure your aws cli. Tagged with credentials, aws, cli, cloudengineering.
🌐
Pluralsight
pluralsight.com › tech insights & how-to guides › cloud
Configuring the AWS Command Line Interface (CLI) | Pluralsight
However, there is one slight difference. You must use the --profile option with the aws configure command and specify a profile name:aws configure --profile my_profile_nameMore information on profiles can be found here.
Find elsewhere
🌐
Amazon Web Services
docs.aws.amazon.com › aws command line interface › user guide for version 2 › configuring settings for the aws cli › configuration and credential file settings in the aws cli
Configuration and credential file settings in the AWS CLI - AWS Command Line Interface
By default, the AWS CLI uses the settings found in the profile named default. To use alternate settings, you can create and reference additional profiles. You can override an individual setting by either setting one of the supported environment variables, or by using a command line parameter. For more information on configuration setting precedence, see Configuring settings for the AWS CLI.
🌐
AWS
docs.aws.amazon.com › aws config › developer guide › getting started with aws config
Getting Started with AWS Config - AWS Config
AWS Config provides a detailed view of the configuration of AWS resources in your AWS account. With AWS Config, you can review changes in configurations and relationships between AWS resources, explore resource configuration history, and use rules to determine compliance.
Top answer
1 of 8
66

If you run aws configure set help you will see that you can supply settings individually on the command line and they will be written to the relevant credentials or config file. For example:

aws configure set aws_access_key_id AKIAI44QH8DHBEXAMPLE

You can also run this interactively to modify the default credentials:

aws configure

Or run it interactively to create/modify a named profile:

aws configure --profile qa

Note: with the first technique above, whatever command you type will appear in your history and this is not a good thing for passwords, secret keys etc. So in that case, use an alternative that does not cause the secret parameter to be logged to history, or prevent the entire command being logged to history.

2 of 8
35

One liner

aws configure set aws_access_key_id "AKIAI44QH8DHBEXAMPLE" --profile user2 && aws configure set aws_secret_access_key "je7MtGbClwBF/2Zp9Utk/h3yCo8nvbEXAMPLEKEY" --profile user2 && aws configure set region "us-east-1" --profile user2 && aws configure set output "text" --profile user2

Note: setting region is optional (also never set it with an empty string if you don't have any region, or it will be buggy); as well as the user profile, if you don't set it it will go under default settings.

Better practice with Secrets

Use secrets, then use associated environment variables:

aws configure set aws_access_key_id "$AWS_ACCESS_KEY_ID" --profile user2 && aws configure set aws_secret_access_key "$AWS_ACCESS_KEY_SECRET" --profile user2 && aws configure set region "$AWS_REGION" --profile user2 && aws configure set output "text" --profile user2

To know more

  • Run aws configure set help to get command line options.
  • Documentation for aws configure set.
  • Documentation for secrets: Docker, Kubernetes, GitLab.
🌐
Medium
medium.com › @amiri.mccain › install-aws-cli-and-configure-credentials-and-config-files-on-a-mac-cda81cf64052
Install AWS CLI and configure “credentials” and “config” files on a Mac | by Amiri McCain | Medium
November 21, 2023 - Install AWS CLI and configure “credentials” and “config” files on a Mac If you want to skip the scenic route and get straight to the solution, scroll down (or ctrl + f) to the “Quick …
🌐
Medium
medium.com › nerd-for-tech › configuration-and-credential-file-settings-in-aws-cli-61c7ff0a1cd6
Configuration and Credential file settings in AWS CLI | by Ankit Gupta | Nerd For Tech | Medium
November 1, 2021 - The AWS CLI stores sensitive credential information that you specify with aws configure in a local file named credentials, in a folder named .aws in your home directory.
🌐
Amazon Web Services
aws.amazon.com › developer center › tools to build on aws › aws cli
AWS CLI
2 days ago - The AWS Command Line Interface (AWS CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.
🌐
Amazon Web Services
docs.aws.amazon.com › aws command line interface › user guide for version 2 › configuring settings for the aws cli › configuring environment variables for the aws cli
Configuring environment variables for the AWS CLI - AWS Command Line Interface
If you specify an option by using one of the environment variables described in this topic, it overrides any value loaded from a profile in the configuration file. If you specify an option by using a parameter on the AWS CLI command line, it overrides any value from either the corresponding environment variable or a profile in the configuration file.
🌐
AWS
docs.aws.amazon.com › aws config › developer guide › what is aws config?
What Is AWS Config? - AWS Config
AWS Config is designed to help you oversee your application resources in the following scenarios: To exercise better governance over your resource configurations and to detect resource misconfigurations, you need fine-grained visibility into what resources exist and how these resources are ...
🌐
K21 Academy
k21academy.com › aws-cloud › aws-config
AWS Config: Overview, Benefits, and How to Get Started?
2 weeks ago - It is a service that enables you to assess, audit, and evaluate the configurations of your AWS resources. It continuously monitors and records your AWS resource configurations and allows the user to automate the evaluation of recorded configurations ...
🌐
AWS
docs.aws.amazon.com › aws config › developer guide › getting started with aws config › setting up aws config with the console › manual setup for aws config
Manual setup for AWS Config - AWS Config
AWS Config Get started workflow provides a detailed manual setup process allowing users to configure resource recording strategies, data governance, and delivery methods through three main steps: Settings, Rules, and Review. This comprehensive setup approach enables users to customize configuration ...