Text of code.claude.com › docs › en › amazon-bedrock as Styx crawled it on Nov 20, 2026. The page may have changed since. Only its words are kept, without pictures or layout, and only the first part of a long page.

Open the live page

Claude Code on Amazon Bedrock - Claude Code Docs

Documentation Index Fetch the complete documentation index at: /docs/llms.txt Use this file to discover all available pages before exploring further. Skip to main content Assistant Responses are generated using AI and may contain mistakes. Prerequisites Before configuring Claude Code with Amazon Bedrock, ensure you have: An AWS account with Amazon Bedrock access enabled Access to desired Claude models (for example, Claude Sonnet 4.6) in Amazon Bedrock AWS CLI installed and configured (optional - only needed if you don’t have another mechanism for getting credentials) Appropriate IAM permissions To sign in with your own Amazon Bedrock credentials, follow Sign in with Amazon Bedrock below.

To deploy Claude Code across a team, use the manual setup steps and pin your model versions before rolling out. Sign in with Bedrock If you have AWS credentials and want to start using Claude Code through Amazon Bedrock, the login wizard walks you through it. You complete the AWS-side prerequisites once per account; the wizard handles the Claude Code side. 1 Enable Anthropic models in your AWS account In the Amazon Bedrock console , open the Model catalog, select an Anthropic model, and submit the use case form.

Access is granted immediately after submission. See Submit use case details for AWS Organizations and IAM configuration for the permissions your role needs. 2 Start Claude Code and choose Amazon Bedrock Run claude . At the login prompt, select 3rd-party platform , then Amazon Bedrock . If you’re already signed in and see the chat prompt instead, run /setup-bedrock to open the wizard. Until CLAUDE_CODE_USE_BEDROCK=1 is set, Claude Code hides the command from the command menu ; type it in full.

3 Follow the wizard prompts Choose how you authenticate to AWS: an AWS profile detected from your ~/.aws directory, an Amazon Bedrock API key, an access key and secret, or credentials already in your environment. The wizard asks for your region, verifies which Claude models your account can invoke, and lets you pin them. It saves the result to the env block of your user settings file , so you don’t need to export environment variables yourself.

After you’ve signed in, run /setup-bedrock any time to reopen the wizard and change your credentials, region, or model pins. The model pin step starts from your currently pinned models. The wizard writes to ~/.claude/settings.json , or to $CLAUDE_CONFIG_DIR/settings.json when CLAUDE_CONFIG_DIR is set. Set up manually To configure Amazon Bedrock through environment variables instead of the wizard, for example in CI or a scripted enterprise rollout, follow the steps below.

1. Submit use case details Before you invoke an Anthropic model for the first time, submit use case details. You do this once per AWS account. Ensure you have the right IAM permissions described below Go to the Amazon Bedrock console Select an Anthropic model from the Model catalog Complete the use case form. Access is granted immediately after submission. If you use AWS Organizations, you can submit the form once from the management account using the PutUseCaseForModelAccess API .

This call requires the bedrock:PutUseCaseForModelAccess IAM permission. Approval extends to child accounts automatically. 2. Configure AWS credentials Claude Code uses the default AWS SDK credential chain. If the machine already supplies credentials to that chain, such as an Amazon EC2 instance profile or Amazon ECS task credentials, skip to step 3 . AWS warns against using an IAM user’s access keys when you develop purpose-built software or work with real data.

Set up your credentials with one of these methods: aws configure : save an IAM user’s access key to a profile in your ~/.aws directory Access key environment variables : set an access key, or temporary credentials with a session token, in the current shell only SSO profile : sign in through IAM Identity Center in your browser and get temporary credentials. Use this method if you access your AWS account through IAM Identity Center.

AWS Management Console credentials : sign in through your browser with your AWS Management Console credentials and get temporary credentials. AWS recommends this method if you access your AWS account as the root user, as an IAM user, or through federation with IAM. Amazon Bedrock API key : authenticate with a bearer token that works only for Amazon Bedrock, instead of AWS credentials Use aws configure Run aws configure and enter your access key ID, secret access key, and default region when prompted: aws configure The AWS CLI saves the key to the default profile in ~/.aws/credentials , where the credential chain reads it.

Export an access key Export your access key as environment variables. AWS_SESSION_TOKEN is required only with temporary credentials, so leave that line out if your access key belongs to an IAM user: export AWS_ACCESS_KEY_ID = your-access-key-id export AWS_SECRET_ACCESS_KEY = your-secret-access-key export AWS_SESSION_TOKEN = your-session-token Use an SSO profile Create a profile with aws configure sso if you don’t have one.

Then sign in to IAM Identity Center and set AWS_PROFILE so the credential chain uses that profile. Replace your-profile-name with the name of your AWS profile before running these commands. aws sso login --profile=your-profile-name export AWS_PROFILE = your-profile-name Claude Code requests role credentials from the IAM Identity Center region named by the profile’s sso_region , which doesn’t need to match the region you run Amazon Bedrock in.

Use AWS Management Console credentials The aws login command requires AWS CLI 2.32.0 or later. For the IAM policy your identity needs, see the AWS instructions for aws login . Run the command to sign in through your browser with your AWS Management Console credentials: aws login The session is valid for up to 12 hours, after which you run aws login again. Use an Amazon Bedrock API key An Amazon Bedrock API key is a bearer token that authenticates your requests in place of AWS credentials.

AWS issues two types of key : Short-term keys : last up to 12 hours. AWS prefers them over long-term keys for production environments. Long-term keys : last until an expiration date you set. AWS recommends them only for exploration. Export the key as AWS_BEARER_TOKEN_BEDROCK : export AWS_BEARER_TOKEN_BEDROCK = your-bedrock-api-key When AWS_BEARER_TOKEN_BEDROCK is set, Claude Code authenticates with the key and doesn’t resolve the credential chain, even if other AWS credentials are present.

Learn more about Amazon Bedrock API keys . Credential caching and resolution timeout Claude Code resolves the AWS default credential provider chain once and keeps the resolved credentials in memory. It reuses them until five minutes before they expire, or for one hour when they carry no expiration, so an SSO-backed profile requests credentials from IAM Identity Center about once per credential lifetime. A credential error from the API clears the cache, and the retry resolves fresh credentials.

The cache covers every credential method listed at the start of this step except an Amazon Bedrock API key, which doesn’t use the provider chain. To resolve the chain on every request instead, set CLAUDE_CODE_SKIP_AWS_CRED_CACHE=1 . The resolve that fills the cache times out after 60 seconds. If a step in the chain stalls, for example a credential_process helper that waits for input it can’t receive, the request fails with AWS default-chain credential resolve timed out .

If your chain runs an interactive sign-in that legitimately needs longer, such as browser-based SSO with MFA through a wrapper like aws-vault , raise the limit in milliseconds with CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS . With CLAUDE_CODE_SKIP_AWS_CRED_CACHE=1 set, each API request resolves the chain without this limit. Except when you authenticate with an Amazon Bedrock API key, the setup wizard applies the same limit to each AWS call it makes while verifying your credentia

The rest of this page is on the live site.