[BUG] Invalid security token error when running Claude Code with AWS Bedrock and credentials from SSO Profile
Environment
- Platform (select one):
- [ ] Anthropic API
- [x] AWS Bedrock
- [ ] Google Vertex AI
- [ ] Other: <!-- specify -->
- Claude CLI version: 1.0.58
- Operating System: macOS 15.5
- Terminal: iTerm2
Bug Description
Anthropic documentation on configuring Claude Code with AWS Bedrock states that it supports setting up credentials via AWS SSO. However, when obtaining credentials in this way and running claude, any request made returns the error "API Error (403 The security token included in the request is invalid.)". At the same time, exporting the credentials into environment variables via aws configure export-credentials --profile PROFILE_NAME --format env and unsetting the AWS_PROFILE environment variable allows requests to go through.
Steps to Reproduce
- run
export AWS_PROFILE=your-profile-name, followed byaws sso login - run
claudeand submit any request
Expected Behavior
Claude Code uses the AWS Bedrock model to complete the request
Actual Behavior
Claude Code returned error "API Error (403 The security token included in the request is invalid.)"
This issue has 8 comments on GitHub. Read the full discussion on GitHub ↗