Running Claude Code Through Amazon Bedrock: Setup, IAM and Cost Controls

1–2 minutes

Updated

Short answer: Claude Code can call Claude models through Amazon Bedrock instead of the Anthropic API. You turn it on with environment variables, give the role a small set of Bedrock permissions, and your usage is billed on the AWS account, where you can track and cap it.

LabEstimated · not yet run
Time
20 min
Cost
Token usage only
Level
Beginner
Services
Bedrock · IAM

Why run it through Bedrock

  • Billing and limits stay on your AWS account, next to everything else.
  • Access is controlled with IAM roles and SSO you already use.
  • Usage can be separated per team with inference profiles and tags.

Step 1: Enable access and permissions

Make sure the Claude models you want are available to your account in the Bedrock console for your region. Then give the developer role permission to invoke them:

claude-code-bedrock-policy.json

{
  "Version": "2012-10-17",
  "Statement": [{
    "Effect": "Allow",
    "Action": [
      "bedrock:InvokeModel",
      "bedrock:InvokeModelWithResponseStream",
      "bedrock:ListInferenceProfiles"
    ],
    "Resource": "*"
  }]
}

Step 2: Point Claude Code at Bedrock

shell

export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1
export AWS_PROFILE=dev-sso   # or any credentials the AWS SDK can find
claude

Claude Code needs AWS_REGION as an environment variable; it does not read the region from your AWS config file.

Step 3: Keep costs visible

  • Create an application inference profile per team and tag it, so Cost Explorer splits the bill.
  • Add an AWS Budgets alert on Bedrock for the account used by developers.
  • Review usage weekly in the first month: coding agents make many calls per task.

Check the Claude Code documentation for the current list of environment variables and model settings: they change with new releases.

Joniel Gallo · Cloud & AI Engineer

I build these labs in a real AWS account and publish the code. Need a second opinion on your architecture or your AWS bill? Work with me.

One tested AWS & AI lab a week

Real costs, working code and what changed in Bedrock this month. Subscribe and get the free AWS Permission Debugger (PDF).