AI Engineer Guide

How to Use Anthropic Claude Code with AWS Bedrock

Claude Code is a CLI based tool that brings in AI coding capabilities directly into your terminal.

Apart from directly using your Anthropic API key, you can also easily use your Amazon Bedrock as well.

Here is how to do it:

Step 1: Configure AWS

You need to make sure that you’ve configured AWS properly in your machine where you’re going to run Claude Code.

You can configure it interactively by running this command

aws configure

Or by setting this env props

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

And make sure to enable required models in AWS Bedrock

Step 2: Configure Claude Code to use AWS Bedrock

Configuring it is straight forward

Just add these env props

export CLAUDE_CODE_USE_BEDROCK=1 # Enable Bedrock integration
export AWS_REGION=us-east-1  # or your preferred region

That’s pretty much it.

Note

By default these models are configured

Model typeDefault value
Primary modelus.anthropic.claude-3-7-sonnet-20250219-v1:0
Small/fast modelus.anthropic.claude-3-5-haiku-20241022-v1:0

But if you need to change it, you can do so by adding it in these env properties

export ANTHROPIC_MODEL='us.anthropic.claude-opus-4-20250514-v1:0'
export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-5-haiku-20241022-v1:0'

References

Happy writing codes!

#Bookmark #Anthropic #Claude-Code