Why Bedrock?

If you're an AWS user, running Claude Code through Bedrock means:

  • No separate Anthropic API billing
  • Usage rolls into your AWS bill
  • You can use long-term API keys (no IAM dance)
  • EU data residency (eu-west-1 = Ireland)

The Setup (5 minutes)

1. Install Claude Code:

curl -fsSL https://claude.ai/install.sh | bash 

2. Generate a Bedrock API key:

AWS Console → Bedrock → long term API keys → Create. Copy it.

3. Create or nano ~/.claude/settings.json:

{ "env": { "CLAUDE_CODE_USE_BEDROCK": "1", "AWS_REGION": "eu-west-1", "AWS_BEARER_TOKEN_BEDROCK": "your-key-here", "ANTHROPIC_MODEL": "eu.anthropic.claude-sonnet-5-5", "ANTHROPIC_SMALL_FAST_MODEL": "eu.anthropic.claude-haiku-4-5" } } 

4. Run it:

cd ~/your-project claude 

No login prompt = you're on Bedrock. Done.

The 6 Errors You'll Actually Hit

1. 403 {"Message":"Invalid API Key format: Must start with pre-defined prefix"}

Cause: A stray ANTHROPIC_API_KEY env var is overriding your Bedrock config. Claude Code is trying to validate your Bedrock key as an Anthropic key (which must start with sk-ant-).

Fix:

unset ANTHROPIC_API_KEY unset ANTHROPIC_AUTH_TOKEN 

Then check for hidden sources:

grep -rn "ANTHROPIC_API_KEY" ~/.bashrc ~/.zshrc ~/.profile ~/projects/.env 2>/dev/null 

Remove any matches. Restart terminal.

Tip: Run /status inside Claude Code to see which credential source is actually active.

2. ValidationException: Operation not allowed

Cause: Your AWS account hasn't been whitelisted for Bedrock model invocation yet. This is an account-level gate, not an IAM or permissions issue. Common on new accounts or accounts with no billing history.

Fix: You can't fix this yourself. Open an AWS Support case:

  • Service: Amazon Bedrock
  • Type: Usage question
  • Message: "Getting 'Operation not allowed' when invoking any model in eu-west-1. Payment method is verified. Please enable model invocation access."

Resolution: 24–48 hours.

⚠️ This is NOT the same as "model not enabled." You can see the model listed in the console but still get this error.

3. Model not found / provided model identifier is invalid

Cause: Wrong model ID or wrong region prefix.

Fix:

  • The region prefix must match your AWS_REGION: us-east-1 → us.anthropic..., eu-west-1 → eu.anthropic...
  • Copy the exact ID from Bedrock Console → Model access. Don't guess.
  • Some models use short IDs (no :0 suffix), some use full versioned IDs. Check the console.
  • You must enable both a primary model (Sonnet/Opus) and a Haiku model, or you'll get a 403 on background calls.

4. 429 Too many tokens / ThrottlingException

Cause: You've hit Bedrock's rate limit for your account tier.

Fix:

  • Wait 30–60 seconds and retry
  • If it's persistent, you're on the free tier with low throughput. Request a limit increase in the Bedrock console (Model access → Throughput)
  • For development, this is usually transient — Claude Code retries automatically

5. AccessDeniedException: You don't have access to the model

Cause: One of three things:

Sub-cause Fix
Model not enabled in that region Enable it in Bedrock Console → Model access
Missing Marketplace subscription Subscribe to the model in AWS Marketplace (new requirement as of 2025)
SCP / permissions boundary blocking bedrock:InvokeModel Check with your org admin

The Marketplace thing is new and undocumented in most guides. If you're on a managed AWS org, your admin may need to allow aws-marketplace:Subscribe for your user.

6. Works in terminal, fails in VS Code / JetBrains

Cause: The IDE's integrated terminal doesn't inherit your shell's env vars, or the IDE's Claude Code extension uses a different credential path.

Fix:

  • VS Code: Add to settings.json:
 { "claudeCode.environmentVariables": { "CLAUDE_CODE_USE_BEDROCK": "1", "AWS_REGION": "eu-west-1", "AWS_BEARER_TOKEN_BEDROCK": "your-key" } } 
  • JetBrains: Set the same vars under Settings → Tools → Terminal → Environment variables
  • Or just use the external terminal (launch claude from a real shell, not the IDE's)

Quick Diagnostic Cheat Sheet

Symptom First thing to check
403 + "Invalid API Key format" `env \
"Operation not allowed" AWS Support case (account whitelist)
"Model not found" Region prefix + exact model ID from console
429 Wait, or request throughput increase
"Access denied" Marketplace subscription + SCP check
Works in CLI, not IDE IDE-specific env var config

Final Tip

Run this to confirm everything is wired correctly:
{% raw %}

claude "What model are you?" 

Expected output:

I'm Claude Sonnet 5.5, running through Claude Code on Amazon Bedrock.