Issue 00 · Autumn 2026日本語 · RSS
AgentKoji

Claude Code on Bedrock, Vertex and Foundry: Setup Guide

Run Claude Code through Amazon Bedrock, Google Cloud's Agent Platform (Vertex AI) or Microsoft Foundry: the env flag, auth, model pinning and what each one lacks.

TL;DR

  • Claude Code runs on Amazon Bedrock, Google Cloud's Agent Platform (formerly Vertex AI) and Microsoft Foundry. You switch with CLAUDE_CODE_USE_BEDROCK, CLAUDE_CODE_USE_VERTEX or CLAUDE_CODE_USE_FOUNDRY, and billing is pay-as-you-go through that cloud.
  • Bedrock and Agent Platform have a login wizard (3rd-party platform at the login prompt). Foundry has none, so you configure it with environment variables only.
  • Pin model versions with ANTHROPIC_DEFAULT_OPUS_MODEL, _SONNET_MODEL and _HAIKU_MODEL before rolling out. Unpinned aliases follow Claude Code's built-in defaults, which may not be enabled in your account.

Claude Code can send its model requests to Amazon Bedrock, Google Cloud’s Agent Platform (formerly Vertex AI) or Microsoft Foundry instead of Anthropic. You set one environment variable to pick the provider, authenticate with that cloud’s credentials, and pay through that cloud’s bill. This guide covers the setup for each provider, model pinning, IAM, and what does not work on each one. For running the same setups in CI, see Claude Code GitLab CI/CD: Setup, Bedrock and Vertex (Beta) and Claude Code GitHub Actions: Setup, @claude and Security.

In our test environment we did not connect to Bedrock, Agent Platform or Foundry (not run). Every command and variable below comes from the official docs.

The three providers at a glance

ProviderEnv flagSetup wizardTypical authNote
Amazon BedrockCLAUDE_CODE_USE_BEDROCK=1Yes (/setup-bedrock)AWS credential chain, SSO or a Bedrock API keyNo web search
Google Cloud’s Agent PlatformCLAUDE_CODE_USE_VERTEX=1Yes (/setup-vertex)Application Default Credentials (gcloud)Model access needs approval
Microsoft FoundryCLAUDE_CODE_USE_FOUNDRY=1NoAPI key, Microsoft Entra ID or a bearer tokenNo GitLab CI/CD

The docs describe billing for all three as pay-as-you-go through AWS, GCP or Azure, and cost tracking through AWS Cost Explorer, GCP Billing or Azure Cost Management. We have not confirmed any prices (unconfirmed). The Claude Code docs list no dollar amounts, so check the cloud’s own pricing page. None of the three includes Claude on the web.

Sources: https://code.claude.com/docs/en/third-party-integrations and https://code.claude.com/docs/en/feature-availability, checked 2026-11-06

Amazon Bedrock

With the wizard

  1. In the Amazon Bedrock console, open the Model catalog, pick an Anthropic model and submit the use case form. The docs say access is granted right after you submit. You do this once per AWS account. With AWS Organizations you can submit once from the management account through the PutUseCaseForModelAccess API, and child accounts inherit it.
  2. Run claude. At the login prompt choose 3rd-party platform, then Amazon Bedrock. If you are already signed in, run /setup-bedrock. The command is hidden from the command menu until CLAUDE_CODE_USE_BEDROCK=1 is set, so type it in full.
  3. Pick an auth method: an AWS profile from ~/.aws, a Bedrock API key, an access key and secret, or credentials already in your environment. The wizard asks for a region, checks which Claude models your account can call, lets you pin them, and saves the result to the env block of ~/.claude/settings.json.

By hand (CI and scripted rollouts)

# Enable Bedrock integration
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1  # optional if your AWS profile already sets a region

Claude Code uses the default AWS SDK credential chain. An EC2 instance profile or ECS task credentials work without extra setup. Otherwise the docs list aws configure, access key environment variables, an SSO profile (aws sso login plus AWS_PROFILE), aws login with console credentials, or a Bedrock API key:

export AWS_BEARER_TOKEN_BEDROCK=your-bedrock-api-key

When AWS_BEARER_TOKEN_BEDROCK is set, Claude Code uses the key and skips the credential chain. AWS prefers short-term keys (up to 12 hours) for production and recommends long-term keys only for exploration.

Without AWS_REGION, Claude Code falls back to AWS_DEFAULT_REGION, then the active profile’s region, then us-east-1. /status shows the region it resolved. /logout is not available on Bedrock, because AWS credentials handle authentication.

IAM

The policy in the docs allows bedrock:InvokeModel, bedrock:InvokeModelWithResponseStream, bedrock:ListInferenceProfiles and bedrock:GetInferenceProfile on inference profiles and foundation models. It also allows aws-marketplace:ViewSubscriptions and aws-marketplace:Subscribe only when called through Bedrock. You can narrow the resources to specific inference profile ARNs. The docs suggest a dedicated AWS account for Claude Code to keep cost tracking and access control simple.

Mantle (optional)

Mantle is a Bedrock endpoint that serves Claude through the Anthropic API shape instead of the Invoke API. Turn it on with CLAUDE_CODE_USE_MANTLE=1. It has its own IAM actions, bedrock-mantle:CreateInference and bedrock-mantle:CountTokens, which the bedrock: actions above don’t cover. Model IDs look like anthropic.claude-sonnet-5, and what you can use depends on what AWS has granted your organization. For running Mantle next to the Invoke API, see the official page.

Source: https://code.claude.com/docs/en/amazon-bedrock, checked 2026-11-06

Google Cloud’s Agent Platform (Vertex AI)

The docs now call the product Google Cloud’s Agent Platform, formerly Vertex AI. The login prompt still shows Google Vertex AI, and the variables still say VERTEX.

With the wizard

  1. Enable the Agent Platform API for your project and request access to the Claude models in Model Garden.
  2. Run claude, choose 3rd-party platform, then Google Vertex AI. If you are already signed in, run /login to reach the same menu.
  3. Pick an auth method: Application Default Credentials from gcloud, a service account key file, or credentials already in your environment. The wizard asks for a project and region, checks the models, lets you pin them and saves to your user settings. Run /setup-vertex later to change any of it.

By hand

# Set your project ID
gcloud config set project YOUR-PROJECT-ID

# Enable Agent Platform API
gcloud services enable aiplatform.googleapis.com

In Model Garden, search for Claude and request the models you want. The docs say approval may take 24–48 hours. Then set:

# Enable Agent Platform integration
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION=global
export ANTHROPIC_VERTEX_PROJECT_ID=YOUR-PROJECT-ID

# When CLOUD_ML_REGION=global, override region for models that don't support global endpoints
export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5
export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1

CLOUD_ML_REGION accepts global, a multi-region location such as eu or us, or a region such as us-east5. Without it, Claude Code uses us-east5. Not every model is offered on every endpoint type, so the VERTEX_REGION_CLAUDE_* variables send a single model to another region. Claude Code sends requests to the project in ANTHROPIC_VERTEX_PROJECT_ID, even when other project variables or the credential file name a different one.

IAM

Grant roles/aiplatform.user. It includes aiplatform.endpoints.predict, which Claude Code needs for model calls and token counting. A custom role with only that permission also works. As with AWS, the docs suggest a dedicated GCP project for Claude Code.

/status should show Google Vertex AI on the API provider line. If that line is missing, the variables are not reaching the process. /logout is not available here either.

Source: https://code.claude.com/docs/en/google-vertex-ai, checked 2026-11-06

Microsoft Foundry

Foundry has no setup wizard. The environment variables are the only way to configure it.

  1. In the Microsoft Foundry portal, create a resource and a deployment for each Claude model you want (Opus, Sonnet, Haiku). Note each deployment name.
  2. Pick one of three auth methods:
    • API key: copy it from Endpoints and keys and set ANTHROPIC_FOUNDRY_API_KEY
    • Microsoft Entra ID: leave both key variables unset. Claude Code uses the Azure SDK default credential chain, such as an az login session
    • Bearer token: set ANTHROPIC_FOUNDRY_AUTH_TOKEN to an Entra ID access token another process obtained. It takes precedence over the API key and the credential chain
  3. Turn Foundry on:
# Enable Microsoft Foundry integration
export CLAUDE_CODE_USE_FOUNDRY=1

# Azure resource name (replace {resource} with your resource name)
export ANTHROPIC_FOUNDRY_RESOURCE={resource}

Set ANTHROPIC_FOUNDRY_RESOURCE to the resource name alone, such as my-resource. Claude Code refuses a URL or host name there. If you need the full URL, use ANTHROPIC_FOUNDRY_BASE_URL instead. A placeholder left in the resource name shows up as repeated connection errors on the first prompt.

For permissions, the built-in Azure AI User and Cognitive Services User roles cover model calls. /status shows Microsoft Foundry on the provider line, and /logout is not available.

Source: https://code.claude.com/docs/en/microsoft-foundry, checked 2026-11-06

Pin your model versions

All three provider pages say to pin model versions before you deploy to several people. Without pins, the opus and sonnet aliases follow Claude Code’s built-in default for that provider. That default can lag the newest release and may not be enabled in your account.

ProviderUnpinned opus resolves toWhat happens if it isn’t available
Amazon BedrockOpus 5.5 (sonnet → Sonnet 4.5)Falls back to an earlier or lower-tier model for the session, with a notice
Agent PlatformOpus 5.5 (sonnet → Sonnet 4.5)Same fallback as Bedrock
Microsoft FoundryOpus 4.6No startup model check. Requests fail

Set the three variables to IDs your account can call. These are the docs’ examples:

# Amazon Bedrock (cross-region inference profile IDs)
export ANTHROPIC_DEFAULT_OPUS_MODEL='us.anthropic.claude-opus-4-8'
export ANTHROPIC_DEFAULT_SONNET_MODEL='us.anthropic.claude-sonnet-4-6'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='us.anthropic.claude-haiku-4-5-20251001-v1:0'

# Google Cloud's Agent Platform
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8'
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'

# Microsoft Foundry (use your deployment names)
export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8'
export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5'
export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5'

On Bedrock, the us. prefix is the cross-region inference profile for us-* regions. Other regions use eu., apac. or global., and GovCloud uses us-gov.. On Foundry, the variables hold your deployment names. If you name a deployment after its model ID, Claude Code can tell which model it serves.

The Bedrock and Agent Platform pages also warn that an unpinned primary model is Opus, billed at the Opus per-token rate, which is higher than Sonnet. To make Sonnet the primary model, set ANTHROPIC_MODEL to its full ID. The rates themselves are on each cloud’s pricing page (unconfirmed here).

For where these variables can live and why one may not take effect, see Claude Code Env Vars Not Working.

Sources: https://code.claude.com/docs/en/amazon-bedrock, https://code.claude.com/docs/en/google-vertex-ai and https://code.claude.com/docs/en/microsoft-foundry, checked 2026-11-06

What does not work on each provider

None of the three can reach features that need a claude.ai subscription. That includes cloud sessions, Claude Code Desktop (except through Claude Desktop on 3P), Code Review, Remote Control, /schedule and Slack. All three also lack fast mode, Advisor, Channels, the analytics dashboard, server-managed settings, /design-sync and /import.

BedrockAgent PlatformFoundry
Web search✗Opus 4, Sonnet 4, Haiku 4.5 and later✓
GitHub Actions✓✓✓
GitLab CI/CD✓✓✗
Auto modeSonnet 5+, Opus 4.7+, Haiku 5.5 and Fable onlySameSame

The CLI, the VS Code and JetBrains extensions, subagents, hooks, skills, MCP servers, CLAUDE.md and managed settings files work on every provider. On these three providers, error reporting and telemetry to Anthropic are off by default.

For scheduled work, the docs suggest /loop in place of /schedule. For cloud sessions, they suggest GitHub Actions or GitLab CI/CD, except on Foundry, where only GitHub Actions is listed.

Source: https://code.claude.com/docs/en/feature-availability, checked 2026-11-06

Keeping credentials out of the repo

More on this in Keep Secrets Away from Claude Code.

Summary

FAQ

How do I switch Claude Code to Amazon Bedrock?
Run claude and choose 3rd-party platform, then Amazon Bedrock, at the login prompt, or run /setup-bedrock if you are already signed in. For CI or scripted rollouts, set CLAUDE_CODE_USE_BEDROCK=1 and AWS_REGION, and provide AWS credentials through the default credential chain or AWS_BEARER_TOKEN_BEDROCK.
Is Google Cloud's Agent Platform the same as Vertex AI?
Yes. The docs call it Google Cloud's Agent Platform, formerly Vertex AI. The login prompt still labels it Google Vertex AI, and the environment variables still say VERTEX, such as CLAUDE_CODE_USE_VERTEX.
Does Microsoft Foundry have a setup wizard?
No. Set CLAUDE_CODE_USE_FOUNDRY=1 and ANTHROPIC_FOUNDRY_RESOURCE to the resource name, then authenticate with an API key, Microsoft Entra ID or a bearer token.
Which features are missing on these providers?
Features that need a Claude subscription, such as cloud sessions and Code Review, plus fast mode, Advisor, Channels, the analytics dashboard and server-managed settings. Web search is not available on Bedrock, and GitLab CI/CD is not available on Foundry.
How much does Claude Code cost on Bedrock, Vertex or Foundry?
Billing is pay-as-you-go through AWS, Google Cloud or Azure. The Claude Code docs list no prices, and we have not confirmed any. Check each cloud's pricing page.