-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
Description
What would you like to see?
The recent implementation of temporary credentials support in PR #2554 (fixing #2299) doesn't fully align with AWS SDK's standard credential provider chain behavior.
Current Behavior
The implementation appears to prioritize explicit credentials (access key, secret key, session token) over the standard AWS credential provider chain.
Expected Behavior
The AWS SDK should follow the standard credential provider chain where:
- The SDK first attempts to use credentials from the container/instance profile (ECS task role, EC2 instance profile)
- Only if that fails, it should fall back to other credential sources in the defined order:
- Environment variables
- Shared credentials file
- Explicitly provided credentials
This is particularly important for containerized environments (like ECS) where best practice is to use task role credentials rather than long-term or even temporary explicit credentials.
Benefits of Following Standard Chain
- Better security by defaulting to short-lived credentials from container/instance roles
- Automatic credential rotation
- Follows AWS security best practices
- Consistent with how other AWS SDKs behave
- No need to manually manage credentials in most AWS deployment scenarios
Proposed Solution
Update the Bedrock client initialization to:
- First create the client without explicit credentials
- Only fall back to explicit credentials if the automatic credential resolution fails
- Maintain backward compatibility for cases where explicit credentials are needed