Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow for manually reloading the configuration file #6872

Open
2 tasks
cwadrupldijjit opened this issue Feb 6, 2025 · 0 comments
Open
2 tasks

Allow for manually reloading the configuration file #6872

cwadrupldijjit opened this issue Feb 6, 2025 · 0 comments
Labels
feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged.

Comments

@cwadrupldijjit
Copy link

cwadrupldijjit commented Feb 6, 2025

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:

  1. Checks if there is an SSO session/configuration set up and if not, it creates one
  2. Checks to see if there are SSO profiles associated with the accounts the user has access to
  3. If there are some accounts missing profiles, it prompts to make more, in which case it shows a wizard to create those profiles
  4. When it creates those profiles, it appends the appropriate configuration to the AWS configuration file
  5. Later on, when it attempts to use one of the profiles newly added to the AWS configuration file, it fails because "the region is missing"

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.

  1. A configuration property passed to a client constructor to indicate that the config file needs to be reloaded
  2. A function that could be called that exists in something like the 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 triggered
  3. If you feel ambitious (though it's probably overkill in most scenarios) track changes of the loaded config file(s) and reload when the file is written to

Other 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 the sso 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

  • have more knowledge about what is expected with contributions such as this, and
  • have more time than I do

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

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)

@cwadrupldijjit cwadrupldijjit added feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged. labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant