aws-sdk-kotlin
aws-sdk-kotlin copied to clipboard
Don't cache instance profile from IMDS credentials provider
Describe the bug
The profile attached to an EC2 instance can change during the lifetime of the instance. The current implementation caches the profile name and re-uses it on every request for credentials.
I have a use-case where the instance profile will change at some point during the execution, so getting credentials will stop working after that because the default credentials provider is requesting the credentials for the old profile.
Expected behavior
Profile name should be refreshed from IMDS unless explicitly overridden in code
Current behavior
Profile name is retrieved once and cached for the lifetime of the provider.
Steps to Reproduce
N/A
Possible Solution
No response
Context
This one stems from a bug filed against the Rust SDK, creating a mirrored issue here since we have the same behavior See https://github.com/awslabs/aws-sdk-rust/issues/384
AWS Kotlin SDK version used
0.9.5-beta
Platform (JVM/JS/Native)
JVM
Operating System and version
N/A