Amazon Bedrock Setup
Deploy Claude Code with AWS Bedrock for enterprise-grade AI capabilities with AWS integration.
Prerequisites
- AWS account with Bedrock access enabled
- Access to desired Claude models in Bedrock
- AWS CLI installed and configured (optional)
- Appropriate IAM permissions
Quick Setup
bash
# Enable Bedrock integration
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1
# Using AWS CLI credentials
aws configureStep-by-Step Setup
Step 1: Submit Use Case Details
First-time Anthropic model users must complete this one-time process:
- Verify proper IAM permissions
- Navigate to Amazon Bedrock console
- Select Chat/Text playground
- Choose any Anthropic model and complete the use case form
Step 2: Configure AWS Credentials
Choose one authentication method:
Option A: AWS CLI
bash
aws configureOption B: Environment Variables (Access Key)
bash
export AWS_ACCESS_KEY_ID=your-access-key-id
export AWS_SECRET_ACCESS_KEY=your-secret-access-key
export AWS_SESSION_TOKEN=your-session-token # if using temporary credentialsOption C: AWS SSO Profile
bash
aws sso login --profile=your-profile-name
export AWS_PROFILE=your-profile-nameOption D: Bedrock API Keys
bash
export AWS_BEARER_TOKEN_BEDROCK=your-bedrock-api-keyStep 3: Enable Bedrock Integration
bash
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1 # or your preferred region
# Optional: Override region for small/fast model
export ANTHROPIC_SMALL_FAST_MODEL_AWS_REGION=us-west-2Important
AWS_REGION is required - Claude Code does not read from .aws config files.
Step 4: Configure Models
Default models:
| Type | Model ID |
|---|---|
| Primary | global.anthropic.claude-sonnet-4-5-20250929-v1:0 |
| Small/Fast | us.anthropic.claude-haiku-4-5-20251001-v1:0 |
Custom models:
bash
# Using inference profile ID
export ANTHROPIC_MODEL='global.anthropic.claude-sonnet-4-5-20250929-v1:0'
export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-haiku-4-5-20251001-v1:0'
# Using application inference profile ARN
export ANTHROPIC_MODEL='arn:aws:bedrock:us-east-2:your-account-id:application-inference-profile/your-model-id'
# Optional: Disable prompt caching
export DISABLE_PROMPT_CACHING=1Step 5: Output Token Configuration
Recommended settings for Bedrock:
bash
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096
export MAX_THINKING_TOKENS=1024Reasoning:
- 4096 tokens: Bedrock's minimum penalty threshold
- 1024 thinking tokens: Balanced for coding tasks
IAM Configuration
Create an IAM policy with minimum required permissions:
json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowModelAndInferenceProfileAccess",
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:ListInferenceProfiles"
],
"Resource": [
"arn:aws:bedrock:*:*:inference-profile/*",
"arn:aws:bedrock:*:*:application-inference-profile/*",
"arn:aws:bedrock:*:*:foundation-model/*"
]
},
{
"Sid": "AllowMarketplaceSubscription",
"Effect": "Allow",
"Action": [
"aws-marketplace:ViewSubscriptions",
"aws-marketplace:Subscribe"
],
"Resource": "*",
"Condition": {
"StringEquals": {
"aws:CalledViaLast": "bedrock.amazonaws.com"
}
}
}
]
}Advanced: SSO Credential Refresh
For automatic credential refresh with AWS SSO:
json
{
"awsAuthRefresh": "aws sso login --profile myprofile",
"env": {
"AWS_PROFILE": "myprofile"
}
}Troubleshooting
Region Issues
bash
# Check available models
aws bedrock list-inference-profiles --region your-region
# Switch to supported region
export AWS_REGION=us-east-1On-Demand Throughput Error
Specify the model as an inference profile ID instead of model ARN.
API Support Note
Claude Code uses the Bedrock Invoke API (not Converse API).
Complete Configuration Example
bash
# ~/.bashrc or ~/.zshrc
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1
export AWS_PROFILE=my-bedrock-profile
export CLAUDE_CODE_MAX_OUTPUT_TOKENS=4096
export MAX_THINKING_TOKENS=1024
export ANTHROPIC_MODEL='global.anthropic.claude-sonnet-4-5-20250929-v1:0'Next Steps
- Google Vertex AI Setup - GCP deployment option
- Model Configuration - Advanced model settings
- Authentication - IAM and security setup