Claude Code with Amazon Bedrock or Google Vertex AI
Run Claude Code with Amazon Bedrock or Vertex AI: the env vars, the model IDs to pin, IAM, and what works differently from a Claude plan.
Contents
Set CLAUDE_CODE_USE_BEDROCK=1 and Claude Code sends its requests to Amazon Bedrock, with the AWS credentials and region it finds. For Google Vertex AI (Google renamed it Agent Platform) the switch is CLAUDE_CODE_USE_VERTEX=1, plus CLOUD_ML_REGION and ANTHROPIC_VERTEX_PROJECT_ID. You can skip the variables: start claude, pick 3rd-party platform at the login prompt, and a wizard sets it up.
Commands, IDs and defaults below are from Anthropic's Bedrock and Agent Platform guides as they read on 22 October 2026.
Why run Claude Code through your cloud?#
Most people who do this are at a company that already buys from Amazon or Google. Four things change, going by Anthropic's docs:
- On Bedrock and Agent Platform, Claude Code is billed per token to your cloud account, on the same bill as everything else you run there. Spend caps are your cloud's budget controls.
- Who may call which model is an IAM policy, not a pile of personal sign-ins. AWS Guardrails can filter content.
- You choose the region, and on Bedrock the inference profile prefix (
us.,eu.,apac.,global.). If your company has data-residency rules, check what your cloud guarantees for that region before relying on it. - Anthropic says Claude Code doesn't send metrics from your cloud back to Anthropic, so its dashboards don't cover this usage. Per-person cost tracking is OpenTelemetry or a gateway's job.
You also pay API rates for every token, with no flat monthly price and no 5-hour window. Depending on how much you use, that works out cheaper or much dearer than a plan; Claude Code with an API key vs a subscription prices both from your own numbers.
Set up Claude Code with Amazon Bedrock#
Before you start#
- An AWS account with Bedrock access.
- The use case form, submitted once per account. It's in the Bedrock console: open the Model catalog, pick an Anthropic model and fill it in. Access comes right after.
- An IAM identity with
bedrock:InvokeModel,bedrock:InvokeModelWithResponseStream,bedrock:ListInferenceProfilesandbedrock:GetInferenceProfile. The full policy is in the docs.
The wizard#
- Run
claude. - At the login prompt choose 3rd-party platform, then Amazon Bedrock.
- Pick how you sign in to AWS (a profile from
~/.aws, a Bedrock API key, an access key, or credentials already in your environment), then a region and the models to pin.
The wizard saves everything to the env block of ~/.claude/settings.json. Run /setup-bedrock later to change it.
By environment variables (CI, scripted rollouts)#
- Make AWS credentials available. Claude Code reads the normal AWS credential chain, so
aws configure, an SSO profile (aws sso login --profile nameplusAWS_PROFILE=name),aws login, exported access keys and a Bedrock API key inAWS_BEARER_TOKEN_BEDROCKall work. - Turn Bedrock on:
export CLAUDE_CODE_USE_BEDROCK=1
export AWS_REGION=us-east-1 # only if your AWS profile has no region
- Pin your models (next section).
- Start
claudeand run/status. It shows the provider and the region it resolved.
For SSO that expires during the day, the awsAuthRefresh setting can run aws sso login for you when credentials run out.
Set up Claude Code with Vertex AI (Agent Platform)#
The product is called Agent Platform now, but Claude Code kept the old name: the login prompt says Google Vertex AI and the variables say VERTEX.
Before you start#
- Enable the API in your project:
gcloud config set project YOUR-PROJECT-ID
gcloud services enable aiplatform.googleapis.com
- In Model Garden, search for Claude and request access to the models you want. Google reviews the request, which can take 24 to 48 hours.
- Your account needs the
roles/aiplatform.userIAM role.
The wizard#
At the login prompt, 3rd-party platform and then Google Vertex AI open the same kind of wizard. It offers Application Default Credentials from gcloud, a service account key file, or credentials in your environment, then asks for your project, region and models. /setup-vertex changes them later.
By environment variables#
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION=global
export ANTHROPIC_VERTEX_PROJECT_ID=YOUR-PROJECT-ID
CLOUD_ML_REGION can be global, a multi-region such as eu or us, or a single region like us-east5. Google doesn't serve every model everywhere, and with global, a model missing there needs its own VERTEX_REGION_CLAUDE_* variable naming a region that has it. Run /status; the API provider line should read Google Vertex AI.
When credentials won't load, gcloud auth application-default login usually fixes it, and the gcpAuthRefresh setting can run that for you.
Pin your model IDs#
Without pins, the opus and sonnet aliases follow Claude Code's built-in defaults for that cloud, which can move ahead of what your account has enabled. Anthropic's advice is to pin before rolling out to a team. As of 22 October 2026, the docs give these defaults:
| Amazon Bedrock | Agent Platform (Vertex AI) | |
|---|---|---|
| Primary model | Opus 5.5, e.g. us.anthropic.claude-opus-5-5 |
claude-opus-5-5 |
| Small/fast model (titles, background work) | Sonnet 4.5, e.g. us.anthropic.claude-sonnet-4-5-20250929-v1:0 |
claude-sonnet-4-5@20250929 |
Pin with the same three variables on both clouds. The Bedrock examples from the docs:
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'
And on 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'
Two cost notes from the docs. If you don't pin a primary model, you are billed at the Opus rate, so set ANTHROPIC_MODEL to a Sonnet ID if that's what you want by default. And on both clouds, background tasks run on Sonnet unless you set ANTHROPIC_DEFAULT_HAIKU_MODEL, because Haiku may not be enabled in every account.
On Bedrock, the us. prefix is a cross-region inference profile. Use eu., apac. or global. to match where you run, or set ANTHROPIC_BEDROCK_REGION_PREFIX to keep the default models with another prefix.
What works differently#
| Claude plan (Pro, Max, Team) | Bedrock / Agent Platform | |
|---|---|---|
| Billing | Flat price per seat or month | Per token, on your cloud bill |
| Limits | 5-hour window and weekly limit | Your cloud quotas and rate limits |
| Sign-in | /login with your Claude account |
Cloud credentials; /logout isn't available |
| Web search tool | Yes | Not on Bedrock |
| Prompt caching | On | On by default on Agent Platform; on Bedrock it may not be in every region |
| 1M-token context | Per plan and model | On by default for the Fable models, Sonnet 5 and later, and Opus 4.7 and later |
| Usage in the status line | 5-hour and weekly fields on Pro and Max | No plan fields; the cost estimate still works |
- Claude Code calls Bedrock's Invoke API, not the Converse API. The error "on-demand throughput isn't supported" means you should use an inference profile ID.
- If a model is disabled in your account, Claude Code falls back to an earlier version of the same tier for that session, unless you pinned a specific version.
- Mantle is a Bedrock endpoint that serves Claude in Anthropic's own API shape, with its own model IDs (
anthropic.claude-sonnet-5) and IAM actions.CLAUDE_CODE_USE_MANTLE=1turns it on. - Your cloud bill shows totals. For a split by developer, Anthropic points to OpenTelemetry export or a gateway.
- A status line keeps showing model, context and the session's estimated cost, but not plan usage. The script in our status line guide copes with the missing fields.
Going through a company gateway#
Some companies put an LLM gateway between developers and the cloud, so keys and logging live in one place. Claude Code works with two kinds.
| The gateway speaks | Point Claude Code at it with | Credentials |
|---|---|---|
| Bedrock's or Vertex's own format | ANTHROPIC_BEDROCK_BASE_URL (or ANTHROPIC_VERTEX_BASE_URL) |
CLAUDE_CODE_SKIP_BEDROCK_AUTH=1 (or CLAUDE_CODE_SKIP_VERTEX_AUTH=1), so it doesn't sign requests with cloud credentials the gateway already holds |
| The Anthropic Messages API | ANTHROPIC_BASE_URL |
The gateway's token in ANTHROPIC_AUTH_TOKEN (or ANTHROPIC_API_KEY), with no CLAUDE_CODE_USE_* variable at all |
Anthropic's gateway guide has a one-line curl test for either. While a gateway credential is active, Remote Control and voice dictation don't work, because both need a claude.ai sign-in.
Bedrock, Vertex and Shuriken#
Shuriken runs Claude Code on the sources you add: Claude sign-ins, API keys and endpoints. It has no Bedrock or Vertex sign-in of its own, so it can't take your AWS profile or gcloud credentials and run Claude Code on them.
An endpoint is an address that speaks the Anthropic Messages API, plus its key. That makes the second kind of gateway above, an Anthropic-compatible one in front of Bedrock or Vertex, a Claude source you can add. Its Model names field sets which of the gateway's models answers when Claude Code asks for Opus, Sonnet or Haiku. Send test message sends one short message to a model you pick, billed at a fraction of a cent, so you know it answers before a chat depends on it.
An endpoint bills per token like any key, so Shuriken never puts it ahead of a subscription. It takes chats when you pick it with Use, or once your subscriptions are out, depending on your switching settings. "Switch to API keys" is off by default, and its spend cap per fallback run is $25 when you turn it on; we wrote up why in API keys as a last resort. Only add sources you are entitled to use, and check with whoever runs the gateway before pointing another tool at it.
If your company's gateway is how you reach Claude, download Shuriken and add it as an endpoint.
Sources
- Claude Code on Amazon Bedrock (Claude Code docs) (accessed 22 October 2026)
- Claude Code on Google Cloud's Agent Platform (Claude Code docs) (accessed 22 October 2026)
- Manage costs effectively: cloud providers (Claude Code docs) (accessed 22 October 2026)
- Connect Claude Code to an LLM gateway (Claude Code docs) (accessed 22 October 2026)
- Environment variables (Claude Code docs) (accessed 22 October 2026)
Frequently asked questions
How do I use Claude Code with Amazon Bedrock?
Start claude and pick 3rd-party platform, then Amazon Bedrock, at the login prompt; the wizard does the rest. Without the wizard, export CLAUDE_CODE_USE_BEDROCK=1 with AWS credentials and a region in place. Afterwards /status names the provider.
How do I use Claude Code with Vertex AI?
Turn on the Agent Platform (Vertex AI) API and request the Claude models in Model Garden. Then either export CLAUDE_CODE_USE_VERTEX=1, CLOUD_ML_REGION and ANTHROPIC_VERTEX_PROJECT_ID, or choose Google Vertex AI under 3rd-party platform at the login prompt.
Does Claude Code on Bedrock or Vertex have the 5-hour and weekly limits?
No. Those belong to Claude subscriptions. On a cloud provider you're billed per token to your cloud account, and the ceilings are your cloud quotas and rate limits.
Can I use my Claude Pro or Max plan through Bedrock?
No. Bedrock and Vertex are billed by Amazon and Google. A Claude plan is a separate sign-in that Claude Code uses when no cloud provider is set.
Which model does Claude Code use on Bedrock by default?
Anthropic's docs, read on 22 October 2026, give Opus 5.5 as the primary model and Sonnet 4.5 for background tasks. Pinning ANTHROPIC_DEFAULT_OPUS_MODEL, ANTHROPIC_DEFAULT_SONNET_MODEL and ANTHROPIC_DEFAULT_HAIKU_MODEL gives everyone on a team the same models.