Switch Claude Code Between the Team Plan and Amazon Bedrock

スポンサーリンク
Switch Claude Code Between the Team Plan and Amazon Bedrock AWS
スポンサーリンク

At work I had set up Claude Code to run through Amazon Bedrock. Later my company handed out the Claude Team plan, so now I have both. Bedrock is pay-per-use, so I want the Team plan by default, with Bedrock only when I need it.

The question was how to switch, in both the terminal Claude Code and the VS Code extension, without fuss. Here is the setup I settled on:

Where How you start it Used
Any normal folder claude in the terminal Team plan
Any normal folder VS Code extension Team plan
Anywhere claude --settings ~/.claude/settings-bedrock.json Bedrock
A dedicated Bedrock folder claude in the terminal Bedrock
A dedicated Bedrock folder VS Code extension Bedrock

Short answer: in the terminal, pass a Bedrock settings file at launch with --settings. The VS Code extension can’t take a settings file at launch, so open a dedicated folder that holds the Bedrock settings instead.

The Bedrock settings file

Put everything needed for Bedrock in one file. I named it ~/.claude/settings-bedrock.json (on Windows, %USERPROFILE%\.claude\settings-bedrock.json). Replace the profile names with your own:

{
  "env": {
    "CLAUDE_CODE_USE_BEDROCK": "1",
    "AWS_PROFILE": "<profile name of your working role>",
    "AWS_REGION": "ap-northeast-1"
  },
  "awsAuthRefresh": "aws login --profile <profile name of your sign-in user>"
}
  • CLAUDE_CODE_USE_BEDROCK: set to 1 to make Claude Code go through Bedrock
  • AWS_PROFILE: the AWS profile to use. In my case, a role allowed to work with AWS resources
  • AWS_REGION: the region where you use Bedrock. I use Tokyo (ap-northeast-1); change it to yours
  • awsAuthRefresh: a command to run when AWS credentials expire. For me it’s aws login as a user that may assume the role above, with Bedrock access

awsAuthRefresh runs only when credentials have expired. According to the official docs, Claude Code first checks whether they really expired; if so, it runs your command, then retries the request. aws login signs in through the browser (AWS CLI 2.32.0 or later), and one sign-in lasts up to 12 hours. If it expires in the middle of long work, you just sign in again in the browser to continue. I also cover aws login in my post on connecting to EC2 without opening the RDP port.

Switching in the terminal

Start with plain claude for the Team plan, or pass the settings file for Bedrock:

claude --settings ~/.claude/settings-bedrock.json

Settings passed with --settings apply only to that session. The next plain claude is back on the Team plan.

Switching in the VS Code extension

The VS Code extension has no way to take a settings file at launch. So I made a folder just for Bedrock work (I called it claude-bedrock), with the same content as settings-bedrock.json in its .claude\settings.local.json:

claude-bedrock\
└─ .claude\
   └─ settings.local.json   ← same content as settings-bedrock.json

Open this folder in VS Code and the Claude Code extension uses Bedrock; every other folder stays on the Team plan. Running claude in the terminal inside this folder also uses Bedrock.

Why this works

Claude Code settings have a precedence order. Per the official docs, from highest:

  1. Settings deployed by your organization’s admin (managed settings)
  2. Settings passed at launch with --settings
  3. The folder’s .claude\settings.local.json
  4. The folder’s .claude\settings.json
  5. Your personal ~/.claude/settings.json

Both --settings and settings.local.json outrank your personal settings. So your normal setup (Team plan) stays as it is, while the launch command, or the folder you open, layers the Bedrock settings on top. The terminal Claude Code reads the same settings files as the VS Code extension, so the folder’s settings.local.json works for both.

Checking which one is running

Run /status inside Claude Code. On the Team plan, “Login method” shows Claude Team account. On Bedrock, “API provider” shows Amazon Bedrock.

On a company PC, how managed settings from your admin are applied depends on the environment. If it doesn’t switch as expected, use /status to see what was loaded.

Things to know when using Bedrock

  • Charges go to Bedrock (your AWS bill), pay-per-use. I keep long sessions on the Team plan
  • Per the official docs, the WebSearch tool isn’t available on Bedrock, nor is /logout (authentication happens on the AWS side)
  • The first time you use a new model on Bedrock you may get a 403 error. I covered the cause, plus the fix, in Bedrock returns 403 only for new Claude models

Summary

  • Put the Bedrock settings (CLAUDE_CODE_USE_BEDROCK, AWS_PROFILE, AWS_REGION, awsAuthRefresh) in one file
  • Terminal: claude --settings with that file means Bedrock; plain claude means the Team plan
  • VS Code extension: open a dedicated folder whose settings.local.json has the same content to use Bedrock
  • Check which one is active with /status

Related posts

References

コメント

Copied title and URL