Configuration and Credential file settings in AWS CLI

Ankit Gupta
Nerd For Tech
Published in
6 min readNov 1, 2021

Part3- With Basic and Important Commands To Know.

This Blogs is the Part3 and its very Interesting because this blog contains less theory and more practical Knowledge. I am trying to explain most basic commands which are used in AWS CLI. In Example I used Command Prompt but AWS Commands are almost same in any type of CLI. Before this Blog I recommended to read these blogs Part One and Part Two.

This Blogs focus on these highlighted Topics which are :

1.Where are configuration settings stored?

2. Set and view configuration settings.

You can save your frequently used configuration settings and credentials in files that are maintained by the AWS CLI.

The files are divided into profiles. By default, the AWS CLI uses the settings found in the profile named default.

A named profile is a collection of settings and credentials that you can apply to a AWS CLI command.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Let understand through Images what profile it is :

  • To show or look for all list of profiles :
$ aws configure list-profiles
pic credit: Ankit Gupta
  • If we have to see default profile :
$ aws configure list
pic credit: Ankit Gupta
  • If we have to create default profile :
 $ aws configure
pic credit: Ankit Gupta
  • If we have to create other than default profile or specific profile ,

For example : Profile named as ‘inter’ and then filled with whatever your Access Key ID , Secret Access Key , region name, output format.

$ aws configure --profile inter
pic credit: Ankit Gupta
  • If you want to review or show your configuration value for a specific profile, you can run
$ aws configure list --profile inter

For example: Profile named: ‘inter’

pic credit: Ankit Gupta

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

1. Where are configuration settings stored?

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. The less sensitive configuration options that you specify with aws configure are stored in a local file named config, also stored in the .aws folder in your home directory.

  • Home directory location in Linux:$HOME or ~ (tilde)
  • Home directory location in Windows : %UserProfile%
pic credit: Ankit Gupta
  • Folder named .aws in your home directory
pic credit: Ankit Gupta
  • A local file named config, credentials and stored in the .aws folder in your home directory.
pic credit: Ankit Gupta
  • If you have to check what are the content of config file(region and output) then write the below command in CMD with extension if have.
type config        #cmd
cat config #bash
pic credit: Ankit Gupta
  • If you have to check what are the content of credentials file(aws_access key id , aws_secret access key) then write the below command in CMD with extension if have.
type credentials       #for cmd
cat credentials #for bash
pic credit: Ankit Gupta

Note ***

Storing credentials in the config file

You can keep all of your profile settings in a single file as the AWS CLI can read credentials from the config file. If there are credentials in both files for a profile sharing the same name, the keys in the credentials file take precedence.

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

2. Set and view configuration settings.

set :

Synopsis -

aws configure set varname value [--profile profile-name]

Examples:

pic credit: Ankit Gupta
pic credit: Ankit Gupta
1. aws configure set region us-west-1 --profile integ
pic credit: Ankit Gupta
2. aws configure set profile.integ.region eu-west-1
pic credit: Ankit Gupta
3. aws configure set aws_access_key_id aaaa --profile integ
4. aws configure set aws_secret_access_key aaaa --profile integ
pic credit: Ankit Gupta

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

get:

Synopsis —

aws configure get varname [--profile profile-name]

Examples:

1. aws configure get aws_access_key_id --profile integ
pic credit: Ankit Gupta
2. aws configure get aws_secret_access_key --profile integ
pic credit: Ankit Gupta
3. aws configure get profile.integ.aws_access_key_id
pic credit: Ankit Gupta
4. aws configure get aws_access_key_id
pic credit: Ankit Gupta

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Conclusion:

I hope this blog helps save you time and money so that you can spend them with your loved ones. Keep smiling and show some love!

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Buy Me a Coffee:

Connect me on Linkedin:

References:

http://d1.awsstatic.com/whitepapers/aws_pricing_overview.pdf

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Other Blogs:

— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —

Thank you for reading, Please if you like hit the Clap button.

Follow us for more content.

Check out for Nerd For Tech more AWS-related content.

More content at Nerd For Tech .

--

--