Bedrock: ANTHROPIC_MODEL ignored, cross-region inference profile used instead causing 403 errors
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When using AWS Bedrock with ANTHROPIC_MODEL set to a foundation model ID (e.g., anthropic.claude-opus-4-5-20251101-v1:0), Claude Code ignores this setting and internally converts it to a cross-region inference profile (us.anthropic.*).
This causes 403 errors when AWS Service Control Policies (SCPs) restrict access to specific regions (e.g., only us-west-2), because the inference profile load-balances requests across multiple regions including us-east-1 and us-east-2.
Key observations:
- The UI shows
arn:aws:bedrock:us-west-2::in…(inference profile) even when foundation model is specified - Error messages show requests being routed to
us-east-2despiteAWS_REGION=us-west-2 - Setting
ANTHROPIC_BEDROCK_BASE_URL='https://bedrock-runtime.us-west-2.amazonaws.com'does not fix the issue - Using full ARN format also doesn't work:
arn:aws:bedrock:us-west-2::inference-profile/us.anthropic.claude-opus-4-5-20251101-v1:0
What Should Happen?
When ANTHROPIC_MODEL is set to a foundation model ID (without us. or global. prefix), Claude Code should:
- Use the foundation model directly, NOT convert it to an inference profile
- Make API calls only to the region specified in
AWS_REGION - Respect the user's explicit model configuration
This would allow users with region-restricted SCPs to use Claude Code with Bedrock by specifying the foundation model and staying within their allowed region.
Error Messages/Logs
403 {"Message":"User: arn:aws:iam::REDACTED:user/some-test-user is not authorized to perform: bedrock:InvokeModelWithResponseStream on resource: arn:aws:bedrock:us-east-2::foundation-model/anthropic.claude-opus-4-5-20251101-v1:0 with an explicit deny in a service control policy: arn:aws:organizations::REDACTED:policy/o-REDACTED/service_control_policy/p-REDACTED"}
Steps to Reproduce
- Set up AWS credentials with an SCP that only allows access to
us-west-2region for Bedrock
- Run Claude Code with the following environment variables:
AWS_REGION=us-west-2 \
AWS_ACCESS_KEY_ID="<your-key>" \
AWS_SECRET_ACCESS_KEY="<your-secret>" \
CLAUDE_CODE_USE_BEDROCK=1 \
ANTHROPIC_MODEL='anthropic.claude-opus-4-5-20251101-v1:0' \
claude
- Observe that the UI shows
arn:aws:bedrock:us-west-2::in…(inference profile) instead of the foundation model
- Send any message (e.g., "test")
- Observe the 403 error showing the request was routed to
us-east-2
Additional attempts that also fail:
- Using
us.anthropic.claude-opus-4-5-20251101-v1:0(US inference profile) - Using full ARN:
arn:aws:bedrock:us-west-2::inference-profile/us.anthropic.claude-opus-4-5-20251101-v1:0 - Adding
ANTHROPIC_BEDROCK_BASE_URL='https://bedrock-runtime.us-west-2.amazonaws.com'
All attempts result in the same error - requests are routed to us-east-2 instead of staying in us-west-2.
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.19
Platform
AWS Bedrock
Operating System
macOS
Terminal/Shell
Terminal.app (macOS)
Additional Information
AWS Bedrock Inference Profile Details
The aws bedrock list-inference-profiles output shows that the US inference profile routes to multiple regions:
"inferenceProfileName": "US Anthropic Claude Opus 4.5",
"description": "Routes requests to Claude Opus 4.5 in us-east-1, us-east-2, us-west-2.",
This is the expected behavior for inference profiles - they load balance across regions. However, when a user explicitly specifies a foundation model ID (without us. or global. prefix), Claude Code should NOT convert it to an inference profile.
Related CHANGELOG entries
- Line 236: "Fixed AWS Bedrock subagents not inheriting EU/APAC cross-region inference model configuration, causing 403 errors when IAM permissions are scoped to specific regions"
- Line 751: "Update Bedrock default Sonnet model to
global.anthropic.claude-sonnet-4-5-20250929-v1:0"
This suggests the default behavior is to use inference profiles, but there should be a way to opt-out for users with region-restricted SCPs.
Suggested Fix
Add support for a configuration option or environment variable (e.g., ANTHROPIC_BEDROCK_DISABLE_INFERENCE_PROFILES=1) that forces Claude Code to use foundation models directly instead of converting to inference profiles.
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗