skip to content

How do you point Claude Code at Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry, and what changes about login once you do?

level: seniorimportance: should knowfreq 10%

answer

  1. an environment switch per provider
  2. the provider's own credential chain
  3. a wizard for two of the three
  4. hidden until the switch is set
  5. top of the precedence order

basics

~10 s

Set CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX or CLAUDE_CODE_USE_FOUNDRY with that cloud's credentials, or run the /setup-bedrock or /setup-vertex wizard. There is no browser login; the provider switch outranks Anthropic keys and the subscription.

solid answer

~30 s

Each provider has a switch: `CLAUDE_CODE_USE_BEDROCK=1` (AWS credentials from the default SDK chain, region from `AWS_REGION` or your profile), `CLAUDE_CODE_USE_VERTEX=1` with `CLOUD_ML_REGION` and `ANTHROPIC_VERTEX_PROJECT_ID`, or `CLAUDE_CODE_USE_FOUNDRY=1` with `ANTHROPIC_FOUNDRY_RESOURCE`. Bedrock and Google Cloud's Agent Platform also have wizards - **3rd-party platform** at the login prompt, or `/setup-bedrock` and `/setup-vertex` later - which save the variables to the `env` block of your user settings; Foundry has no wizard. No claude.ai browser login happens, the switch sits at the top of the credential order, and usage bills to your cloud account. On Bedrock `/logout` is unavailable because AWS credentials do the authenticating.

code

bash · 7 lines
bash
# Amazon Bedrock, manual setup (CI or a scripted rollout)
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_PROFILE=claude-dev      # resolved through the AWS SDK chain
export AWS_REGION=us-east-1        # optional if the profile sets a region
claude

# Inside the session: /status shows the resolved region and provider

go deeper

for a junior

Recall that each cloud provider is selected with a CLAUDE_CODE_USE_ variable and that no browser login is involved.

for a middle

Describe the per-provider variables, the 3rd-party platform wizard, and where /setup-bedrock and /setup-vertex save their settings.

for a senior

Explain that the switch outranks every Anthropic credential and moves billing to the cloud account, and plan a team rollout with distributed variables and pinned models.

for a principal

Compare a cloud provider with Team or Enterprise seats for an organisation: billing consolidation, keeping inference inside your cloud account, and features that need a claude.ai login.

## One switch per provider Claude Code can send its model requests to a cloud provider instead of the Anthropic API. You choose the provider with an environment variable; the provider's own credentials do the authenticating. | Provider | Switch | Other variables you set | Interactive setup | |---|---|---|---| | Amazon Bedrock | `CLAUDE_CODE_USE_BEDROCK=1` | `AWS_REGION` only if your AWS profile has no region | `/setup-bedrock` | | Google Cloud's Agent Platform | `CLAUDE_CODE_USE_VERTEX=1` | `CLOUD_ML_REGION`, `ANTHROPIC_VERTEX_PROJECT_ID` | `/setup-vertex` | | Microsoft Foundry | `CLAUDE_CODE_USE_FOUNDRY=1` | `ANTHROPIC_FOUNDRY_RESOURCE` (the resource name alone) | none | The docs call Google's service Google Cloud's Agent Platform, but the switch is still named `CLAUDE_CODE_USE_VERTEX`, and the login prompt still labels the option Google Vertex AI. ## Where credentials come from - **Bedrock** uses the **default AWS SDK credential chain** - a profile in `~/.aws`, access keys, an Amazon Bedrock API key or credentials already in the environment. The region resolves from `AWS_REGION`, then `AWS_DEFAULT_REGION`, then the active profile, then `us-east-1`; `/status` shows the resolved region. - **Google Cloud's Agent Platform** uses Google credentials such as Application Default Credentials from `gcloud auth application-default login`; `gcpAuthRefresh` can name a command that refreshes them. - **Foundry** uses `ANTHROPIC_FOUNDRY_API_KEY`, `ANTHROPIC_FOUNDRY_AUTH_TOKEN`, or the Azure default credential chain when neither is set. ## The wizards For Bedrock and Google Cloud's Agent Platform you need not export anything yourself: 1. Run `claude` and pick **3rd-party platform** at the login prompt, then the provider. 2. The wizard asks how you authenticate, asks for the region (and the project, on Google Cloud), verifies which Claude models the account can call, and offers to pin them. 3. It saves the result to the **`env` block of your user settings**, `~/.claude/settings.json`, or the settings file under `CLAUDE_CONFIG_DIR` when that is set. Already signed in? Run `/setup-bedrock` or `/setup-vertex` to reopen the wizard. Each command is **hidden from the command menu until its switch is set**, so on a fresh machine you type it in full. Microsoft Foundry has no wizard: the environment variables are its only configuration path. ## What changes about login - **No browser login.** The claude.ai login screen is not involved. - **Top of the precedence order.** With a provider switch set, Claude Code uses that provider's credentials even if `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN`, `apiKeyHelper` or a `/login` subscription is also present. (A signed-in Claude apps gateway session is the one thing that outranks the switch.) - **Billing moves to the cloud.** Usage is billed per token to your cloud account and seen in its billing console. - **Some commands change.** On Bedrock `/logout` is unavailable, because AWS credentials, not a stored login, authenticate the session. - **It persists.** Because the wizard writes the switch into your user settings, every later session on that machine uses the provider until you remove the variable from that `env` block. A developer who tried Bedrock once and later wonders why their subscription shows no usage usually has exactly this leftover. ## Checking it took effect, and side effects - Run `/status`: with Bedrock it shows the resolved region and, when the region came from your AWS config files or the fallback, where it came from. - Some tools differ by provider. The WebSearch tool is not available on Amazon Bedrock, and on native Windows the PowerShell tool, on by default for claude.ai and Console accounts, needs `CLAUDE_CODE_USE_POWERSHELL_TOOL=1` in Bedrock, Google Cloud and Foundry sessions. - For short-lived AWS logins, the `awsAuthRefresh` setting names a command such as `aws sso login` that Claude Code runs when the current credentials stop working; `gcpAuthRefresh` plays the same role on Google Cloud. ## Rolling it out to a team For a team, the docs recommend the manual route: distribute the environment variables (in a shared settings file or your device tooling) and pin model versions before rollout, so a changing default does not move everyone onto a model the account cannot call. Which Claude models the cloud account may invoke, IAM policy and the provider's own APIs are covered by the Bedrock and Google Cloud material; choosing and pinning models is the model-configuration material. This question is only how Claude Code is pointed at the provider.

  • A developer with CLAUDE_CODE_USE_BEDROCK set also has a Max subscription logged in. Which one pays for their requests?
    Bedrock. The cloud-provider switch ranks above every Anthropic credential, including the `/login` subscription, so requests go to Bedrock and bill the AWS account. Unset the switch, and remove it from any settings `env` block the wizard wrote, to go back to the subscription.
  • Why might `/setup-vertex` not appear when you start typing it in Claude Code?
    Claude Code hides `/setup-vertex` from the command menu until `CLAUDE_CODE_USE_VERTEX=1` is set, and likewise `/setup-bedrock` until `CLAUDE_CODE_USE_BEDROCK=1`. Type the command in full, or pick 3rd-party platform at the login prompt, to open the wizard.

  • Bedrock users still need a claude.ai login first
  • An ANTHROPIC_API_KEY outranks the Bedrock switch
  • Microsoft Foundry is configured through its own setup wizard
  • The Vertex switch was renamed along with the service
  • /setup-bedrock writes the project's shared .claude/settings.json