Setting and Updating AWS CLI Configuration


Before you set AWS CLI configuration credentials to interact with your AWS services via command line, it is important that you have AWS CLI 2 installed on your device.

Follow this link - https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html to install CLI on your Windows/Mac/Linux/Ubuntu device.

Steps to setup AWS CLI Configure on Mac (macOS)/Linux/Ubuntu:

  1. Open Terminal App,
  2. Type command: aws configure
  3. Provide the AWS Access Key ID
  4. Provide the AWS Secret Access Key
  5. Provide the Default region name
  6. Provide the Default output format
Example:
% aws configure
AWS Access Key ID [None]: 
AWS Secret Access Key [None]: 
Default region name [None]: 
Default output format [None]: 

Steps to setup AWS CLI Configure on Windows:

  1. Open Command Prompt (or use Git Bash, Powershell or Bash for Windows),
  2. Type command: aws configure
  3. Provide the AWS Access Key ID
  4. Provide the AWS Secret Access Key
  5. Provide the Default region name
  6. Provide the Default output format

List of AWS Regions:

You can set the default region code from the below available AWS Regions as of August 2022.

Region Name Region Code
US East (Ohio) us-east-2
US East (N. Virginia) us-east-1
US West (N. California) us-west-1
US West (Oregon) us-west-2
Africa (Cape Town) af-south-1
Asia Pacific (Hong Kong) ap-east-1
Asia Pacific (Jakarta) ap-southeast-3
Asia Pacific (Mumbai) ap-south-1
Asia Pacific (Osaka) ap-northeast-3
Asia Pacific (Seoul) ap-northeast-2
Asia Pacific (Singapore) ap-southeast-1
Asia Pacific (Sydney) ap-southeast-2
Asia Pacific (Tokyo) ap-northeast-1
Canada (Central) ca-central-1
China (Beijing) cn-north-1
China (Ningxia) cn-northwest-1
Europe (Frankfurt) eu-central-1
Europe (Ireland) eu-west-1
Europe (London) eu-west-2
Europe (Milan) eu-south-1
Europe (Paris) eu-west-3
Europe (Stockholm) eu-north-1
Middle East (Bahrain) me-south-1
South America (São Paulo) sa-east-1

List of Output formats for AWS CLI Configuration:

1 - json
2 - yaml
3 - yaml-stream
4 - text
5 - table

How to re-configure AWS CLI configuration

If you want to change any of the credentials or configurations at any time, you can do that by executing the same aws configure command again, pressing enter with no text to keep the previous values and typing in the text where you want to change it.

% aws configure
AWS Access Key ID [****************AAPX]: ASLJFKSFYWPQOUCASVSH12
AWS Secret Access Key [****************wrgR]:
Default region name [us-east-1]: us-east-2
Default output format [table]: json
Re-setting up AWS Configurations and Credentials
Advertisements
Try Out Code2care Dev Tools:

Advertisements

Advertisements
Code2care is an initiative to publish and share varied knowledge in programming and technical areas gathered during day-to-day learnings and development activities.

Students and software developers can leverage this portal to find solutions to their various queries without re-inventing the wheel by referring to our easy to understand posts. Technical posts might include learnings, tutorials, trouble-shooting steps, video tutorials, code snippets, how-to, blogs, articles, etc.

🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.