Extend Claude Code Usage with AWS Bedrock Integration
Running low on Claude Code Pro tier usage but not ready to upgrade to Max? Learn how to configure Claude Code to use Claude Sonnet models from AWS Bedrock as a cost-effective alternative. This step-by-step guide walks you through setting up environment variables and switching between Claude API and Bedrock seamlessly.
Note: There is a newer version of blog ["Integrate Claude with AWS Bedrock"](https://builder.aws.com/content/3Ex2TtcjcDE2OW6n7Iy2oH7CiBz/integrate-claude-with-aws-bedrock) which covers the latest Claude model Fable 5.
Claude Code offers two subscription tiers: Pro and Max. The Max tier costs at least 5 times more than Pro but provides significantly higher usage quotas. If you've exhausted your Pro tier usage but aren't ready to upgrade to Max, you can temporarily use Claude Sonnet models from AWS Bedrock instead.
This guide shows you how to connect Claude Code to Claude models in Bedrock.
Step 1: Verify Your AWS CLI Configuration
- Confirm you have an active AWS CLI profile by running following command. It should return your AWS user ID and account number.
1
aws sts get-caller-identity- If you have multiple AWS profiles configured, check which profile is currently active:
1
echo $AWS_PROFILEStep 2: Identify Available Inference Profiles
- List the available inference profile IDs:
1
aws bedrock list-inference-profiles --region us-west-2 | grep inferenceProfileArn | grep global.anthropicThis will return profiles similar to:
1
2
3
4
"inferenceProfileArn": "arn:aws:bedrock:us-west-2:460453255610:inference-profile/global.anthropic.claude-sonnet-4-20250514-v1:0",
"inferenceProfileArn": "arn:aws:bedrock:us-west-2:460453255610:inference-profile/global.anthropic.claude-haiku-4-5-20251001-v1:0",
"inferenceProfileArn": "arn:aws:bedrock:us-west-2:460453255610:inference-profile/global.anthropic.claude-opus-4-5-20251101-v1:0",
"inferenceProfileArn": "arn:aws:bedrock:us-west-2:460453255610:inference-profile/global.anthropic.claude-sonnet-4-5-20250929-v1:0",- Select one inference profile ARN for standard tasks and another for smaller, faster tasks.
Step 3: Configure Environment Variables
When the environment variable
CLAUDE_CODE_USE_BEDROCK is set to 1, Claude Code will check the ANTHROPIC_MODEL variable. If it contains a valid model ARN or inference profile ARN, Claude Code will use the specified Bedrock model; otherwise, it defaults to the Claude API.- Create a bash configuration file (e.g.,
~/.claude_code_enable_bedrock) with the following settings:
1
2
3
4
5
6
export AWS_PROFILE=<YOUR_AWS_PROFILE_NAME>
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_MODEL='global.anthropic.claude-sonnet-4-5-20250929-v1:0'
export ANTHROPIC_SMALL_FAST_MODEL='global.anthropic.claude-haiku-4-5-20251001-v1:0'
# Control prompt caching - set to 1 to disable, 0 to enable
export DISABLE_PROMPT_CACHING=0Note: Replace the AWS profile name and ARNs with your own values.
Step 4: Activate Bedrock Integration
- Source the configuration file to make the environment variables persist in your shell session:
1
source ~/.claude_code_enable_bedrockImportant: Use
source rather than executing the file directly. Executing the file would create a new bash session where the environment variables only exist temporarily.- Now start your Claude Code session:
1
claude- You can chat with Claude on the model which it is using. This will verify whether your
~/.claude_code_use_bedrockfile is configured properly.
1
2
3
4
> which model are you using?
⏺ I'm powered by Claude Sonnet 4. The exact model ID is global.anthropic.claude-sonnet-4-5-20250929-v1:0.
...Step 5: Disable Bedrock Integration (Optional)
To switch back to using the Claude API, clear the environment variables and restart your Claude session.
- Create a bash file (e.g.,
~/.claude_code_disable_bedrock) with:
1
2
3
4
unset CLAUDE_CODE_USE_BEDROCK
unset ANTHROPIC_MODEL
unset ANTHROPIC_SMALL_FAST_MODEL
unset DISABLE_PROMPT_CACHING- Source the file and restart Claude Code.
1
2
source ~/.claude_code_disable_bedrock
claude- Chat with Claude to confirm that it is now using model from Claude API server.
1
2
3
> which model are you using?
⏺ I'm using Claude Sonnet 4.5 (model ID: claude-sonnet-4-5-20250929).Summary
This blog post explains how to configure Claude Code to use AWS Bedrock models as an alternative to the Claude API, particularly useful when Pro tier usage is exhausted but upgrading to Max tier isn't desired.
Enjoyed reading this content? Let the author know!
Your likes, comments, shares, and saves help creators reach more builders.
Loading recommendations
Loading article