onelogin / onelogin-python-aws-assume-role

MIT License
58 stars 52 forks source link

Use config file instead of credentials file when generating AWS CLI config #38

Closed ldormoy closed 4 years ago

ldormoy commented 4 years ago

According to the AWS CLI doc:

The AWS CLI can also read credentials from the config file. You can keep all of your profile settings in a single file. If there are ever credentials in both locations for a profile (say you used aws configure to update the profile's keys), the keys in the credentials file take precedence.

I think it would make sense to use the config file as:

Important note about the AWS config file and named profiles:

The credentials file uses a different naming format than the CLI config file for named profiles. Include the prefix word "profile" only when configuring a named profile in the config file. Do not use the word profile when creating an entry in the credentials file.

So if you do make this change, it's important to prefix the profile with profile, except if it's the default profile.

Do you have the capacity to work on this soon? Asking because otherwise I can try to submit a PR, if it's okay for you.

ldormoy commented 4 years ago

I mistakenly assumed that --aws-region was used to set the region in the config, but I realize now it's used as config parameter for the AWS SDK client .

I guess the easiest way to deal with it is to keep a separate static .aws/config with the region set for each profile.