Support Amazon Bedrock API Keys

Status Fixed / completed
Maintainer reply ✓ Yes — ant-kurt
Activity 7 comments · opened Jul 10, 2025 · closed Jul 14, 2025
💡 Likely answer: A maintainer (ant-kurt, collaborator) responded on this thread — see the highlighted reply below.

AWS recently launched API keys for Amazon Bedrock (announced July 8, 2025), offering a much simpler authentication method than the current IAM role setup.

We propose adding support for these API keys to streamline the initial configuration for claude-code users on AWS. This would significantly improve the developer experience by providing a straightforward alternative to manual IAM policy and principal configuration.

Suggested Implementation

Support could be implemented by having claude-code recognize and use a new environment variable containing the Bedrock API key. The AWS SDK for Python (Boto3) can automatically use the AWS_BEARER_TOKEN_BEDROCK environment variable to authenticate.

For example:

import boto3

# Boto3 client automatically uses the key set in the environment variable:
# export AWS_BEARER_TOKEN_BEDROCK=${your-bedrock-api-key}

client = boto3.client(
    service_name="bedrock-runtime",
    region_name="us-east-1"
)

response = client.converse(
    modelId="us.anthropic.claude-3-5-haiku-20241022-v1:0",
    messages=[{"role": "user", "content": [{"text": "Hello"}]}],
)

print(response['output']['message']['content'][0]['text'])

View original on GitHub ↗

7 Comments

ant-kurt collaborator · 1 year ago

This is shipping in upcoming release 1.0.49, via the AWS_BEARER_TOKEN_BEDROCK env var!

jonathanlaniado · 1 year ago

Great to hear!

jonathanlaniado · 1 year ago

I see this has now been released. Can't seem to make it work though. Does this environment variable need to be called with any others?

I've tried CLAUDE_CODE_USE_BEDROCK and AWS_REGION.

mslvance · 1 year ago
I see this has now been released. Can't seem to make it work though. Does this environment variable need to be called with any others? I've tried CLAUDE_CODE_USE_BEDROCK and AWS_REGION.

Hey, were you able to get the API Key system working?

Here's how I did it; it might help you:

1. I created a settings.json file in /home/myuser/.claude:

{
      "env": {
        "AWS_BEARER_TOKEN_BEDROCK": "api-key",
        "AWS_REGION": "your aws region here",
        "CLAUDE_CODE_USE_BEDROCK": "1"
      }
}

2. My permanent bash variables (.zshrc or .bashrc`):

# Claude Code + AWS Bedrock config

    export CLAUDE_CODE_USE_BEDROCK=1

    # AWS Bedrock API Key
    export AWS_BEARER_TOKEN_BEDROCK='api-key-here'
    export AWS_REGION=your-aws-region

    # Models
    export ANTHROPIC_MODEL='us.anthropic.claude-sonnet-4-20250514-v1:0'
    export ANTHROPIC_SMALL_FAST_MODEL='us.anthropic.claude-3-5-haiku-20241022-v1:0'

Try this out and see if it works.

mslvance · 1 year ago

I'm not sure which of these settings is redundant, but this is what worked for me. It's worth testing.

ant-kurt collaborator · 1 year ago

I personally had an issue where my API key only had access to one region, so needed to make it was aligned with the Claude Code AWS_REGION.

Closing this issue - feel free to comment if you're running into issues with this!

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.