[BUG] Bedrock integration is not working

Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 5 comments · opened Mar 22, 2025 · closed May 21, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

Environment

  • Platform (select one):
  • [ ] Anthropic API
  • [x] AWS Bedrock
  • [ ] Google Vertex AI
  • [ ] Other: <!-- specify -->
  • Claude CLI version: 0.2.53 (Claude Code)
  • Operating System: macOS 15.3.1
  • Terminal:iTerm2

Bug Description

Unable to use bedrock , it was working a few days ago.

Steps to Reproduce

I tried

ANTHROPIC_MODEL='us.anthropic.claude-3-7-sonnet-20250219-v1:0' \
CLAUDE_CODE_USE_BEDROCK=1 \
CLAUDE_CODE_DEBUG=1 \
AWS_REGION_NAME='us-west-2' \
AWS_DEFAULT_REGION='us-west-2' \
claude
╭─────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview!                  │
│                                                             │
│   /help for help                                            │
│                                                             │
│   cwd: /xxxx  │
╰─────────────────────────────────────────────────────────────╯

> /init is analyzing your codebase…
  ⎿  API Error: 403 You don't have access to the model with the specified model ID.

I then try to use full arn for inference profile, now claude returns a different error message

ANTHROPIC_MODEL='arn:aws:bedrock:us-west-2::inference-profile/us.anthropic.claude-3-7-sonnet-20250219-v1:0' \
CLAUDE_CODE_USE_BEDROCK=1 \
AWS_REGION_NAME='us-west-2' \
AWS_DEFAULT_REGION='us-west-2' \
claude
╭─────────────────────────────────────────────────────────────╮
│ ✻ Welcome to Claude Code research preview!                  │
│                                                             │
│   /help for help                                            │
│                                                             │
│   cwd: /xxx  │
╰─────────────────────────────────────────────────────────────╯

> /init is analyzing your codebase…
  ⎿  API Error: Truncated event message received.

Expected Behavior

claude works with bedrock

Actual Behavior

errors

View original on GitHub ↗

5 Comments

stefwoj · 1 year ago

I have the same issue.

md-ae · 1 year ago

This issue occurs when there is a mismatch with the AWS_REGION and/or the incorrect cross-region inference profile ids are used (or not activated in the region you think they are activated).

  1. Enable model access in the correct region in the AWS Console: Amazon Bedrock > Model access
  2. Use Inference profile IDs from: Amazon Bedrock > Cross-region inference

Examples of valid parameters to run Claude Code:

AWS_REGION='us-east-1' ANTHROPIC_MODEL='us.anthropic.claude-3-5-sonnet-20241022-v2:0' ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-5-sonnet-20241022-v2:0' CLAUDE_CODE_USE_BEDROCK=1 CLAUDE_CODE_DEBUG=1 DISABLE_PROMPT_CACHING=1 claude

AWS_REGION='eu-west-1' ANTHROPIC_MODEL='eu.anthropic.claude-3-7-sonnet-20250219-v1:0' ANTHROPIC_SMALL_FAST_MODEL='eu.anthropic.claude-3-5-sonnet-20240620-v1:0' CLAUDE_CODE_USE_BEDRO
CK=1 DISABLE_PROMPT_CACHING=1 CLAUDE_CODE_DEBUG=1 claude

yangcheng · 1 year ago

@md-ae thanks that's helpful. I have aws_region configured in aws cli, but did not expect to set the AWS_REGION env

ant-kurt collaborator · 1 year ago

@yangcheng hopefully the AWS_REGION env var resolved this for you! Please reply if you're still running in to this issue.

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.