Claude Platform on AWS is the Anthropic-operated Claude API with AWS authentication, IAM access control, and AWS Marketplace billing. Requests reach Anthropic's API directly, so you get the same models and API features as the Claude API on the same release schedule. Client-side features that Claude Code turns on through Anthropic's feature-flag service, such as /loop self-pacing, are off by default, and the advisor tool is not available. See the feature availability matrix for the full list. You authenticate with AWS credentials or a workspace API key, and you pay through AWS Marketplace.
Use this guide to point Claude Code at a workspace you've already provisioned through Claude Platform on AWS. For the AWS subscription and workspace setup that comes before this, see the Claude Platform on AWS documentation.
Prerequisites
Before configuring Claude Code, you need:
An active Claude Platform on AWS subscription through AWS Marketplace
A workspace in your AWS-linked Anthropic organization, with its workspace ID
An IAM principal with permission to invoke the Anthropic service, or an API key scoped to the workspace
AWS credentials in your environment, in ~/.aws/credentials, or from an attached IAM role if you want SigV4 authentication. The AWS CLI is required only for the SSO login flow.
Setup
1. Configure AWS credentials
Claude Code supports two authentication methods for Claude Platform on AWS. Choose the method that fits how your team manages access.
Option A: AWS credentials with SigV4
Claude Code signs requests with SigV4 using the standard AWS credential chain: environment variables, shared credentials in ~/.aws/credentials, IAM roles, AWS SSO sessions, and any other sources the AWS SDK supports.
For local use, log in with the AWS CLI before starting Claude Code. The example below uses an SSO profile, but any method that produces credentials in the standard locations works.
For CI and automation, give the runner an IAM role with permission to invoke the Anthropic service and set AWS_REGION. The credential chain picks the role up automatically.
If your SSO credentials expire mid-session, configure awsAuthRefresh so Claude Code re-runs your login command and retries instead of failing. Automatic refresh on Claude Platform on AWS requires Claude Code v2.1.198 or later; earlier versions stop with a prompt to run /login, which can't refresh AWS credentials. Add the command to your settings file, such as ~/.claude/settings.json:
Claude Code also runs this command at startup when it can't validate your existing AWS credentials, and shows the command's output in a Cloud authentication panel until the login completes.
With awsAuthRefresh configured, /login shows a Claude Platform on AWS · refresh credentials option under Using 3rd-party platforms. Selecting it runs the configured command and re-reads your AWS credentials without restarting Claude Code.
Option B: Workspace API key
A workspace API key is a long-lived secret, useful when you don't want to manage federated AWS credentials. Generate one in the AWS Console under Claude Platform on AWS → API keys and set it as ANTHROPIC_AWS_API_KEY:
export ANTHROPIC_AWS_API_KEY=sk-ant-xxxxx
The key is sent as x-api-key and takes precedence over SigV4, so any AWS credentials in your environment are ignored. API keys from a separate Claude Console organization won't work here.
Treat workspace API keys like any other production credential. The user settings fileenv block is a convenient way to scope the key to your machine without exporting it globally.
2. Configure Claude Code
Set the environment variables that route Claude Code through Claude Platform on AWS instead of the default Anthropic API.
ANTHROPIC_AWS_WORKSPACE_ID is required and is sent on every request as the anthropic-workspace-id header. Replace the example wrkspc_01ABCDEFGHIJKLMN value with your own workspace ID from your Claude Platform on AWS setup. The base URL is computed from AWS_REGION as https://aws-external-anthropic.{region}.api.aws. To override the URL directly, set ANTHROPIC_AWS_BASE_URL.
Claude Platform on AWS is opt-in even when AWS credentials are present in your environment. Amazon Bedrock and Microsoft Foundry take precedence in provider routing, so unset CLAUDE_CODE_USE_BEDROCK and CLAUDE_CODE_USE_FOUNDRY if they're set.
3. Pin model versions
Claude Platform on AWS uses the same model IDs as the direct Claude API.
The default aliases fable, opus, sonnet, and haiku resolve to Claude Code's built-in defaults for Claude Platform on AWS, which can lag the newest release. Without ANTHROPIC_DEFAULT_OPUS_MODEL, the opus alias resolves to Opus 4.8. {/* min-version: 2.1.207 */}Before v2.1.207, it resolved to Opus 4.7.
If you deploy Claude Code to a team, pin the model IDs explicitly so a new release doesn't move everyone at once:
Prompt caching is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set ENABLE_PROMPT_CACHING_1H=1. The API bills 1-hour cache writes at a higher rate. See prompt caching pricing for the rates.
4. Launch and verify
Start Claude Code and confirm the routing:
claude
The startup banner shows Claude Platform on AWS when the provider is active. Run /status to check the details: the API provider line reads Claude Platform on AWS, and the output includes your Workspace ID, the AWS region, and the Claude Platform on AWS base URL if you set an override.
Use the Agent SDK
The Agent SDK reads the same environment variables as the CLI, so any program that spawns the Claude Code subprocess can target Claude Platform on AWS by exporting CLAUDE_CODE_USE_ANTHROPIC_AWS, ANTHROPIC_AWS_WORKSPACE_ID, and either ANTHROPIC_AWS_API_KEY or AWS credentials before the call.
This example relies on the ambient AWS credential chain for SigV4. To authenticate with a workspace API key instead, set ANTHROPIC_AWS_API_KEY the same way. For the broader Agent SDK surface, see Agent SDK overview.
Route through a corporate proxy
To route traffic through a proxy or LLM gateway, set ANTHROPIC_AWS_BASE_URL to the proxy's address. Claude Code sends requests to that URL with the same workspace and authentication headers, so any gateway that forwards them unchanged works.
If your gateway signs requests itself, set CLAUDE_CODE_SKIP_ANTHROPIC_AWS_AUTH=1 so Claude Code sends unsigned requests and lets the gateway add SigV4 headers before forwarding to AWS. If the gateway requires its own token, set it in ANTHROPIC_AUTH_TOKEN.
Run /status to see the resolved provider and any explicitly configured workspace ID, region, base URL override, and auth-skip setting. This is the fastest way to confirm Claude Code is targeting Claude Platform on AWS at all.
403 Forbidden or AccessDenied on every request
The IAM principal Claude Code resolved likely lacks permission to invoke the Anthropic service in your workspace. Check the role attached to your AWS profile or the runner that started Claude Code, and verify it has the aws-external-anthropic actions documented in the IAM action reference.
If you set ANTHROPIC_AWS_API_KEY, the key takes precedence over SigV4 and a stale key produces the same error. Regenerate the key in the AWS Console under Claude Platform on AWS → API keys or unset the variable to fall back to your AWS credentials.
Requests fail with a missing-workspace error
ANTHROPIC_AWS_WORKSPACE_ID is likely unset or empty. Every Claude Platform on AWS request must include the workspace ID. It is not implied by your AWS credentials. Find the ID in your Claude Platform on AWS setup and export it before starting Claude Code.
Requests still go to api.anthropic.com
CLAUDE_CODE_USE_ANTHROPIC_AWS is likely unset or set to a value that doesn't parse as truthy. Set it to 1 and run /status to confirm the resolved provider. If CLAUDE_CODE_USE_BEDROCK or CLAUDE_CODE_USE_FOUNDRY is also set, those take precedence over Claude Platform on AWS.
Additional resources
The Claude Platform on AWS subscription, workspace, and IAM setup that comes before configuring Claude Code is covered in the platform documentation:
225For CI and automation, give the runner an IAM role with permission to invoke the Anthropic service and set `AWS_REGION`. The credential chain picks the role up automatically.225For CI and automation, give the runner an IAM role with permission to invoke the Anthropic service and set `AWS_REGION`. The credential chain picks the role up automatically.
226226
227If your SSO credentials expire mid-session, configure [`awsAuthRefresh`](/en/amazon-bedrock#advanced-credential-configuration) so Claude Code re-runs your login command and retries instead of failing. Automatic refresh on Claude Platform on AWS requires Claude Code v2.1.198 or later; earlier versions stop with a prompt to run `/login`, which can't refresh AWS credentials. Add the command to your `settings.json`:227If your SSO credentials expire mid-session, configure [`awsAuthRefresh`](/en/amazon-bedrock#advanced-credential-configuration) so Claude Code re-runs your login command and retries instead of failing. Automatic refresh on Claude Platform on AWS requires Claude Code v2.1.198 or later; earlier versions stop with a prompt to run `/login`, which can't refresh AWS credentials. Add the command to your [settings file](/en/settings), such as `~/.claude/settings.json`:
228228
229```json theme={null}229```json theme={null}
230{230{
232}232}
233```233```
234234
235Claude Code also runs this command at startup when it can't validate your existing AWS credentials, and shows the command's output in a Cloud authentication panel until the login completes.
236
235With `awsAuthRefresh` configured, `/login` shows a **Claude Platform on AWS · refresh credentials** option under **Using 3rd-party platforms**. Selecting it runs the configured command and re-reads your AWS credentials without restarting Claude Code.237With `awsAuthRefresh` configured, `/login` shows a **Claude Platform on AWS · refresh credentials** option under **Using 3rd-party platforms**. Selecting it runs the configured command and re-reads your AWS credentials without restarting Claude Code.
236238
237**Option B: Workspace API key**239**Option B: Workspace API key**
263`ANTHROPIC_AWS_WORKSPACE_ID` is required and is sent on every request as the `anthropic-workspace-id` header. The base URL is computed from `AWS_REGION` as `https://aws-external-anthropic.{region}.api.aws`. To override the URL directly, set `ANTHROPIC_AWS_BASE_URL`.265`ANTHROPIC_AWS_WORKSPACE_ID` is required and is sent on every request as the `anthropic-workspace-id` header. Replace the example `wrkspc_01ABCDEFGHIJKLMN` value with your own workspace ID from your Claude Platform on AWS setup. The base URL is computed from `AWS_REGION` as `https://aws-external-anthropic.{region}.api.aws`. To override the URL directly, set `ANTHROPIC_AWS_BASE_URL`.
264266
265Claude Platform on AWS is opt-in even when AWS credentials are present in your environment. Amazon Bedrock and Microsoft Foundry take precedence in provider routing, so unset `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_FOUNDRY` if they're set.267Claude Platform on AWS is opt-in even when AWS credentials are present in your environment. Amazon Bedrock and Microsoft Foundry take precedence in provider routing, so unset `CLAUDE_CODE_USE_BEDROCK` and `CLAUDE_CODE_USE_FOUNDRY` if they're set.
266268
283285
284[Prompt caching](/en/prompt-caching) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`. The API bills 1-hour cache writes at a higher rate. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing) for the rates.286[Prompt caching](/en/prompt-caching) is enabled automatically. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`. The API bills 1-hour cache writes at a higher rate. See [prompt caching pricing](https://platform.claude.com/docs/en/build-with-claude/prompt-caching#pricing) for the rates.
285287
288### 4. Launch and verify
289
290Start Claude Code and confirm the routing:
291
292```bash theme={null}
293claude
294```
295
296The startup banner shows `Claude Platform on AWS` when the provider is active. Run `/status` to check the details: the `API provider` line reads `Claude Platform on AWS`, and the output includes your `Workspace ID`, the `AWS region`, and the `Claude Platform on AWS base URL` if you set an override.
297
286## Use the Agent SDK298## Use the Agent SDK
287299
288The [Agent SDK](/en/agent-sdk/overview) reads the same environment variables as the CLI, so any program that spawns the Claude Code subprocess can target Claude Platform on AWS by exporting `CLAUDE_CODE_USE_ANTHROPIC_AWS`, `ANTHROPIC_AWS_WORKSPACE_ID`, and either `ANTHROPIC_AWS_API_KEY` or AWS credentials before the call.300The [Agent SDK](/en/agent-sdk/overview) reads the same environment variables as the CLI, so any program that spawns the Claude Code subprocess can target Claude Platform on AWS by exporting `CLAUDE_CODE_USE_ANTHROPIC_AWS`, `ANTHROPIC_AWS_WORKSPACE_ID`, and either `ANTHROPIC_AWS_API_KEY` or AWS credentials before the call.
332344
333### Requests fail with a missing-workspace error345### Requests fail with a missing-workspace error
334346
335`ANTHROPIC_AWS_WORKSPACE_ID` is likely unset or empty. Every Claude Platform on AWS request must include the workspace ID. It is not implied by your AWS credentials. Find the ID under **Workspaces**ontheAWSConsoleservicepage and export it before starting Claude Code.347`ANTHROPIC_AWS_WORKSPACE_ID` is likely unset or empty. Every Claude Platform on AWS request must include the workspace ID. It is not implied by your AWS credentials. Find the ID inyourClaudePlatformonAWSsetup and export it before starting Claude Code.
336348
337### Requests still go to `api.anthropic.com`349### Requests still go to `api.anthropic.com`