'How to update credentials file of aws cli?

My credentials file of aws looks this way.

vagrant@vagrant:~/.aws$ cat credentials
[default]
aws_access_key_id = *****************
aws_secret_access_key = ***************
[mysubaccount1]
role_arn = arn:aws:iam::**********:role/OrganizationAccountAccessRole
source_profile = default
[mysubaccount2]
role_arn = arn:aws:iam::**********:role/OrganizationAccountAccessRole
source_profile = default

Need to see any options to update that here.

I tried below command to list the existing profiles to frame any condition, but it is giving error as syntax invalid.

vagrant@vagrant:~/.aws$ aws configure list-profiles
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
aws: error: argument subcommand: Invalid choice, valid choices are:

list                                     | get
set                                      | add-model

Any aws config commands or any bash script you can suggest to update the details coming from terraform output when we create the account from there to update or add a new profile like mysubaccount3.



Solution 1:[1]

The command is

aws configure list

not

aws configure list-profiles

Also, you can easily edit the .aws/credentials files with any text editor and add/remove/update any entry there.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 baduker