Amazon Bedrock integration
This page provides instructions on configuring Claude Code through Amazon Bedrock, including setup, IAM configuration, cost tracking, and troubleshooting.
Prerequisites
Before configuring Claude Code with Bedrock, ensure you have:
- An AWS account with Bedrock access enabled
- Access to desired Claude models (e.g., Claude Sonnet 4) in Bedrock
- AWS CLI installed and configured (optional - only needed if you don’t have another mechanism for getting credentials)
- Appropriate IAM permissions
Setup
1. Enable model access
First, ensure you have access to the required Claude models in your AWS account:
- Navigate to the Amazon Bedrock console
- Go to Model access in the left navigation
- Request access to desired Claude models (e.g., Claude Sonnet 4)
- Wait for approval (usually instant for most regions)
2. Configure AWS credentials
Claude Code uses the default AWS SDK credential chain. Set up your credentials using one of these methods:
Claude Code does not currently support dynamic credential management (such as automatically calling aws sts assume-role
). You will need to run aws configure
, aws sso login
, or set the AWS_
environment variables yourself.
Option A: AWS CLI configuration
Option B: Environment variables (access key)
Option C: Environment variables (SSO profile)
3. Configure Claude Code
Set the following environment variables to enable Bedrock:
AWS_REGION
is a required environment variable. Claude Code does not read from the .aws
config file for this setting.
Contact AWS support to enable prompt caching for reduced costs and higher rate limits. Once enabled, remove the DISABLE_PROMPT_CACHING
setting.
4. Model configuration
Claude Code uses these default models for Bedrock:
Model type | Default value |
---|---|
Primary model | us.anthropic.claude-3-7-sonnet-20250219-v1:0 |
Small/fast model | us.anthropic.claude-3-5-haiku-20241022-v1:0 |
To customize models, use one of these methods:
IAM configuration
Create an IAM policy with the required permissions for Claude Code.
For details, see Bedrock IAM documentation.
We recommend creating a dedicated AWS account for Claude Code to simplify cost tracking and access control.
Troubleshooting
If you encounter region issues:
- Check model availability:
aws bedrock list-inference-profiles --region your-region
- Switch to a supported region:
export AWS_REGION=us-east-1
- Consider using inference profiles for cross-region access
If you receive an error “on-demand throughput isn’t supported”:
- Specify the model as an inference profile ID