Use XDG Base Directory Specification
The XDG specification defines where configuration files and credential files should be placed.
Following this standard ensures a clean home directory and some consistency across applications.
The default directory to write configuration and credentials files should be ${XDG_CONFIG_HOME:-${HOME}/.config}/aws (or %LOCALAPPDATA%\aws\config).
The default directory to read configuration and credentials files should be ${XDG_CONFIG_HOME:-${HOME}/.config}/aws (or %LOCALAPPDATA%\aws\config) first, then ${HOME}/.aws to maintain backwards compatibility.
What do you think?
I am willing to file a change request if this design is accepted.
I hope the Windows values make some sense, as I am not an expert.
cf. https://github.com/aws/aws-cli/issues/2433
This proposal does not change the default override logic: the environment variables AWS_SHARED_CREDENTIALS_FILE and AWS_CONFIG_FILE should maintain their precedence, just like the specific environment variables and command-line switches that refer to specific keys like AWS_ACCESS_KEY_ID or --region <string>.
The proposed change only affects the hardcoded default fallback locations.
@pierreprinetti In general, I don't think we're against this change it's simply been more of a priority issue than anything else. There's a relatively high amount of friction in making a change like this as botocore and the AWS CLI aren't the only tools that look at these files. If we make this change it puts pressure on other tools to follow suite (read as we'll likely need consensus before making the change). To be blunt, we likely won't have much time to look into this anytime soon as it's functionally the same and there are workarounds (mentioned in the other thread) if one is really inclined on getting this behavior.
If this was possible with a small change (and I am not sure it is), would you accept a PR that:
- on the write side: does not change where the credentials are created; but
-
on the read side: looks into
~/.awsand into the XDG directory?
This feature request is now being tracked here in our cross-SDK repository: https://github.com/aws/aws-cli/issues/9031. Feature requests involving credentials/configuration need to be reviewed at a cross-SDK level, since other SDKs rely on those in addition to the CLI. Will close this issue to continue tracking there.
This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.