Allow for manually reloading the configuration file #6872
Labels
feature-request
New feature or enhancement. May require GitHub community feedback.
needs-triage
This issue or PR still needs to be triaged.
Describe the feature
There used to be a way for global credentials/configuration to be refreshed via the
AWS.config.refresh(...)
API. Potentially some clients (or all clients) will still read from the global AWS config file, which is great. However, sometimes the case may require that config to be refreshed because of changes made during the execution of the script prior to when the AWS SDK and associated clients are instantiated.For many reasons, it seems like a similar mechanism no longer exists, in part because configuration can be done per-client (at least according to how I understand the documentation). But the problem isn't so much in the client itself being configured differently. It lies much more in the fact that the config file is read up front and to my knowledge and from reading through the API reference docs and even perusing some of the code, it doesn't appear that there is a mechanism to manually trigger a refresh of the config file.
If there already exists a way to do this, I'm all ears. I also would prefer to not explicitly set all of the profile information via the constructor and call to
fromSso
, as it sorta defeats the purpose of having the profiles in the config file.Use Case
In my case, I had a script that interacts with and simplifies some aspects of using the SSM Session Manager and does the following:
When it would be useful is if I could manually trigger a refresh is between the last two bullets so that any attempt to use a client with that new profile will not fail.
Proposed Solution
There are a few ways I can think of that could help accomplish this.
token-providers
package that could be used to refresh the config file for when it's explicitly or implicitly used by clients constructed after the refresh is triggeredOther Information
When I encountered this problem, I thought it was a problem with my script, but on further examination it was coming from the smithy code. Reading through the documentation and code, it indicated that the newly-saved profile was not loaded. It can be seen even more clearly that when I restarted my script, it had the profile in the config file and the attempt to use it worked without any further edits.
I take it that the change relates to the
token-providers
or thesso
or any of the clients or similar packages that might be loading the configuration file.I did not consider this a bug because I assume the config file is loaded up front instead of on instantiation of the clients for performance reasons and I don't want this to infringe on that consideration. Instead, having this as a separate feature to opt into makes the most sense to me.
As a short note about the "Acknowledgements", I probably could implement this feature request if I
Acknowledgements
SDK version used
3.743.0
Environment details (OS name and version, etc.)
Ubuntu 22.04.1, used under WSL v2.4.10.0 on Windows 11 Enterprise (version 23H2, build 22631.4751)
The text was updated successfully, but these errors were encountered: