Add cloud-providers module: keyless Spring AI on Amazon Bedrock (AWS default credential chain under IRSA and EKS Pod Identity) and Azure OpenAI (managed identity, Microsoft Entra ID bearer tokens), an audit advisor, and the traps reproduced (leftover static key beats the role, AWS_REGION ignored by Bedrock auto-configuration, short-lived credentials refetched per call, azure-identity missing, leftover OPENAI_API_KEY, other modalities defaulting to OpenAI, SigV4 session token in AWS SDK DEBUG logs). No AWS account or Azure subscription used: a local server stands in for STS, Bedrock, the Azure identity endpoint and Azure OpenAI; the Spring AI, AWS SDK and azure-identity code is real. Spring Boot 4.2.0, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b5uEyg58znuchZ8C8i
This commit is contained in:
Ankur
2026-11-29 13:25:58 +05:30
co-authored by Claude Sonnet 5.5
parent 98ed878675
commit 8f69e7bf50
46 changed files with 1729 additions and 0 deletions
@@ -0,0 +1,23 @@
# Bedrock with IRSA: no key in the application, the default chain finds the projected token
Environment the pod gets (the only configuration the application receives):
AWS_ROLE_ARN = arn:aws:iam::111122223333:role/spring-ai-bedrock
AWS_WEB_IDENTITY_TOKEN_FILE = <projected service account token>
(AWS_ENDPOINT_URL_* point at the local stub; on EKS they are absent)
spring.ai.bedrock.aws.access-key / secret-key / session-token: not set
Application output:
INFO audit - provider=bedrock principal=arn:aws:sts::111122223333:assumed-role/spring-ai-bedrock/pod-session model=us.anthropic.claude-sonnet-4-5-20250929-v1:0 outcome=OK inputTokens=12 outputTokens=7 ms=<n>
ANSWER 1: Hello from the Bedrock stub.
STS received 1 AssumeRoleWithWebIdentity call(s) (1 GetCallerIdentity for the audit identity)
Authorization header on AssumeRoleWithWebIdentity: null (this call is not signed)
RoleArn = arn:aws:iam::111122223333:role/spring-ai-bedrock
RoleSessionName starts with = aws-sdk-java-
WebIdentityToken equals the token file content: true
Bedrock received POST /model/us.anthropic.claude-sonnet-4-5-20250929-v1:0/converse
signed by access key id : ASIASTUB0000... (temporary: starts with ASIA)
signing service / region: bedrock / us-east-1
x-amz-security-token signed: true
X-Amz-Security-Token header present: true