Walkthrough: Setting Up Claude Code on Amazon Bedrock
Claude Code supports both Amazon Bedrock Google Vertex AI, making it enterprise ready without egress to external vendors like Anthropic’s API. Unfortunately, the minimalistic documentation provided by Anthropic for setting up Claude Code with AWS Bedrock lacks sufficient information. Many users, including yours truely, got stuck with the same problem, as seen in the comments of Jonathan Evan’s Claude Code Setup Guide.
We spent time digging throught the codebase to figure out how Claude Code configures Amazon Bedrock. The code snippets is here:
We also reached out to Jonathan Evans for tips. Here’s a comprehensive guide to seeting up Claude Code with Amazon Bedrock, including code snippets and configuration details.
0. AWS Bedrock Setup
Claude Code requires two models: Claude 3.7 Sonnet
and Claude 3.5 Haiku
. Be sure to request them in us-east-1
, which is the default region for Claude Code.
1. Inference Profile
For cloud security best practices, create a new policy in AWS Identiy and Access Management (IAM) for model inferencing and invocation. Name it AmazonBedrockInferenceProfile
for clarity. Attach this policy to the IAM user or group associated with your AWS access key and secret.
The IAM policy should look like this.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:CreateInferenceProfile",
"bedrock:GetInferenceProfile",
"bedrock:ListInferenceProfiles",
"bedrock:InvokeModel*"
],
"Resources": "*"
}
]
}
Once this is done on the AWS side, you can test it quickly with the following script.
2. Configure Local AWS Settings
Ensure your AWS access key and secret are stored in the [default]
profiles of your ~/.aws/config/credentials
file.
Your config file should look like this:
[default]
region = us-east-1
output = json
NOTE:
AWS_REGION
for AWS andCLAUDE_ML_REGION
for GCP can be set as environment variables or in settings. We couldn’t get these to work reliably, so we stuck with the default settings.
3. Setup Environment Variables
Add the following to your .bashrc
, .zshrc
, .profile
, or config.fish
depending on your shell:
# Configure for Bedrock with Claude 3.7 Sonnet
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_MODEL='us.anthropic.claude-3-7-sonnet-20250219-v1:0'
# Disaable prompt caching (not supported by AWS Bedrock yet
export DISABLE_PROMPT_CACHING=1
After this, we are all good to go. Let’s claude
from terminal.
References
- Claude Code Overview. Anthropic Documentation https://docs.anthropic.com/en/docs/agents-and-tools/claude-code/overview
- Claude Code on Amazon Bedrock: Quick Setup Guide
@article{
leehanchung,
author = {Lee, Hanchung},
title = {Poking Around Claude Code},
year = {2025},
month = {03},
howpublished = {\url{https://leehanchung.github.io}},
url = {https://leehanchung.github.io/blogs/2025/03/08/claude-code-bedrock/}
}