claude-in-amazon-bedrock
build-with-claude/claude-in-amazon-bedrock
History
build-with-claude/claude-in-amazon-bedrock Changed · +2 / -2 lines
<Tabs> <Tab title="Gradle"> ```kotlin - implementation("com.anthropic:anthropic-java-bedrock:2.57.0") + implementation("com.anthropic:anthropic-java-bedrock:2.58.0") ``` </Tab>
<dependency> <groupId>com.anthropic</groupId> <artifactId>anthropic-java-bedrock</artifactId> - <version>2.57.0</version> + <version>2.58.0</version> </dependency> ``` </Tab>
build-with-claude/claude-in-amazon-bedrock Changed · +1 / -1 lines
## Supported models -Model IDs in Claude in Amazon Bedrock carry an `anthropic.` provider prefix. Model capabilities and behaviors are documented on the [Models overview](https://platform.claude.com/docs/en/about-claude/models/overview) page. +Model IDs in Claude in Amazon Bedrock carry an `anthropic.` provider prefix. Model capabilities and behaviors are documented on the [Models overview](https://platform.claude.com/docs/en/models/overview) page. | Model | Model ID | Access | | --------------------- | ------------------------------- | --------------------------------------------------------------------------------------------------- |
build-with-claude/claude-in-amazon-bedrock Changed · +1 / -0 lines
* API endpoints (Message Batches, Models, Admin, Compliance, Usage and Cost) * Claude Managed Agents * Server-side fallback (the [`fallbacks` parameter](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#server-side-fallback); use the [client-side fallback pattern](https://platform.claude.com/docs/en/build-with-claude/refusals-and-fallback#client-side-fallback) instead) +* [Computer use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/computer-use-tool) and [browser use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/browser-use-tool) toolsets (`computer_toolset_20260801` and `browser_toolset_20260801` are not currently available on Amazon Bedrock; the beta computer use tool versions remain available) ## Regions
build-with-claude/claude-in-amazon-bedrock Changed · +2 / -2 lines
<Tabs> <Tab title="Gradle"> ```kotlin - implementation("com.anthropic:anthropic-java-bedrock:2.53.0") + implementation("com.anthropic:anthropic-java-bedrock:2.57.0") ``` </Tab>
<dependency> <groupId>com.anthropic</groupId> <artifactId>anthropic-java-bedrock</artifactId> - <version>2.53.0</version> + <version>2.57.0</version> </dependency> ``` </Tab>
build-with-claude/claude-in-amazon-bedrock First recorded · 422 lines, first recorded
## Access ## Prerequisites ## Authentication ### Bedrock service role (recommended) ### IAM assumed roles ### Bearer tokens ## Install an SDK ## Making your first request ## Supported models ## Feature support ### Supported feature highlights ### Features not supported ## Regions ## Quotas ## Data retention ## Monitoring and logging ## Support
The first capture of this source. The page was already there, and this is what it said.
---
title: Claude in Amazon Bedrock (Opus 4.7 and later)
url: https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock
description: Access Claude models through Amazon Bedrock with AWS-native authentication, billing, and security boundaries.
---
This guide walks you through setting up and making API calls to Claude in Amazon Bedrock. Claude in Amazon Bedrock runs on AWS-managed infrastructure with zero operator access (Anthropic personnel have no access to the inference infrastructure), letting you build sensitive applications entirely inside the AWS security boundary while using the same Messages API shape you use with Anthropic's first-party API.
<Note>
This page covers Claude in Amazon Bedrock, which serves Claude through the Messages API at `/anthropic/v1/messages` on AWS-managed infrastructure. The previous Amazon Bedrock integration (the `InvokeModel` and `Converse` APIs with ARN-versioned model identifiers) remains available and is documented at [Claude on Amazon Bedrock (Opus 4.6 and earlier)](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy). For an Anthropic-operated alternative on AWS with AWS Marketplace billing and typically same-day feature access, see [Claude Platform on AWS](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws).
</Note>
## Access
Amazon Bedrock sets access criteria for each Claude model individually. Claude Fable 5, Claude Opus 4.8, Claude Sonnet 5, Claude Opus 4.7, and Claude Haiku 4.5 are open to all Amazon Bedrock customers; for any other model's current criteria, check [Amazon Bedrock model access](https://console.aws.amazon.com/bedrock/home#/modelaccess) in the AWS console. Claude Mythos Preview requires an invitation; see [Project Glasswing](https://anthropic.com/glasswing). For region availability, see [Regions](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#regions).
## Prerequisites
Before you begin, ensure you have:
* An AWS account with [Amazon Bedrock model access](https://console.aws.amazon.com/bedrock/home#/modelaccess) enabled for the Claude models you intend to use.
* The [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html) installed and configured (optional, for credential management).
Claude Mythos Preview additionally requires a dedicated AWS account that has been allowlisted by the Bedrock Marketplace team. Your Anthropic account executive can submit your account ID for allowlisting (typically processed within 24 hours), and AWS sends a welcome email once it's complete.
## Authentication
Claude in Amazon Bedrock supports three authentication paths. Choose the one that best fits your security requirements.
### Bedrock service role (recommended)
Use a Bedrock service role with AWS-managed keys for the most secure, long-lived access:
<Steps>
<Step title="Admin: provision the service role">
An AWS administrator provisions a Bedrock service role and grants developers `iam:PassRole` permission on the service role ARN.
</Step>
<Step title="Developer: pass the role">
When calling the API, Bedrock assumes the service role on your behalf. See the [Amazon Bedrock documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/bedrock-mantle.html) for how to associate the role with your requests.
</Step>
</Steps>
### IAM assumed roles
For identity-federated access with a 12-hour maximum session:
<Steps>
<Step title="Admin: configure the IAM role">
Create an IAM role scoped to your Claude models. The trust policy names your identity provider (SAML, OIDC, or AWS Identity Center). The permissions policy grants `bedrock-mantle:CreateInference` only on the allowed model ARNs.
</Step>
<Step title="Developer: authenticate and assume">
Authenticate through your corporate identity provider, then assume the IAM role. AWS STS issues temporary credentials that the SDK or CLI uses to sign requests.
</Step>
</Steps>
### Bearer tokens
For short-term access without IAM roles (12-hour maximum, least preferred):
<Steps>
<Step title="Admin: restrict token types">
Block long-term keys by attaching a policy that denies `bedrock:CallWithBearerToken` unless the `bedrock:BearerTokenType` condition matches a short-term token.
</Step>
<Step title="Developer: mint a token">
Use the `aws-bedrock-token-generator` CLI to mint a bearer token. Pass it in the `x-api-key` header on each request.
</Step>
</Steps>
## Install an SDK
Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) support Claude in Amazon Bedrock through a Bedrock-specific package or module.
<Tabs>
<Tab title="Python">
```bash
pip install -U "anthropic[bedrock]"
```
</Tab>
<Tab title="TypeScript">
```bash
npm install @anthropic-ai/bedrock-sdk
```
</Tab>
<Tab title="C#">
```bash
dotnet add package Anthropic.Bedrock
```
</Tab>
<Tab title="Go">
```bash
go get github.com/anthropics/anthropic-sdk-go/bedrock
```
</Tab>
<Tab title="Java">
<Tabs>
<Tab title="Gradle">
```kotlin
implementation("com.anthropic:anthropic-java-bedrock:2.53.0")
```
</Tab>
<Tab title="Maven">
```xml
<dependency>
<groupId>com.anthropic</groupId>
<artifactId>anthropic-java-bedrock</artifactId>
<version>2.53.0</version>
</dependency>
```
</Tab>
</Tabs>
</Tab>
<Tab title="PHP">
```bash
composer require anthropic-ai/sdk aws/aws-sdk-php
```
</Tab>
<Tab title="Ruby">
```bash
# Gemfile
gem "anthropic"
gem "aws-sdk-core"
```
</Tab>
</Tabs>
## Making your first request
The endpoint follows the pattern `https://bedrock-mantle.{region}.api.aws/anthropic/v1/messages`. Unlike the `InvokeModel`-based integration, this endpoint uses standard SSE streaming and the same request body shape as Anthropic's first-party API.
The SDK resolves credentials and region using the standard AWS precedence: constructor arguments, then environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`, `AWS_SESSION_TOKEN`, `AWS_REGION`), then the AWS config file and credential chain (SSO, assumed roles, ECS task role, IMDS).
<Tabs>
<Tab title="cURL">
```bash
curl https://bedrock-mantle.us-east-1.api.aws/anthropic/v1/messages \
--aws-sigv4 "aws:amz:us-east-1:bedrock-mantle" \
--user "$AWS_ACCESS_KEY_ID:$AWS_SECRET_ACCESS_KEY" \
-H "x-amz-security-token: $AWS_SESSION_TOKEN" \
-H "content-type: application/json" \
-H "anthropic-version: 2023-06-01" \
-d '{
"model": "anthropic.claude-opus-5",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "Hello, Claude"}
]
}'
```
</Tab>
<Tab title="CLI">
The `ant` CLI does not support Amazon Bedrock. Use either cURL or an SDK.
</Tab>
<Tab title="Python">
```python
from anthropic import AnthropicBedrockMantle
client = AnthropicBedrockMantle(aws_region="us-east-1")
message = client.messages.create(
model="anthropic.claude-opus-5",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(next(block.text for block in message.content if block.type == "text"))
```
</Tab>
<Tab title="TypeScript">
```typescript
import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk";
const client = new AnthropicBedrockMantle({
awsRegion: "us-east-1"
});
const message = await client.messages.create({
model: "anthropic.claude-opus-5",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }]
});
const textBlock = message.content.find((block) => block.type === "text");
if (textBlock) {
console.log(textBlock.text);
}
```
</Tab>
<Tab title="C#">
```csharp
using Anthropic.Bedrock;
using Anthropic.Models.Messages;
var client = new AnthropicBedrockMantleClient(new() { AwsRegion = "us-east-1" });
var message = await client.Messages.Create(new()
{
Model = "anthropic.claude-opus-5",
MaxTokens = 1024,
Messages = [new() { Role = Role.User, Content = "Hello, Claude" }],
});
foreach (var item in message.Content)
{
if (item.Value is TextBlock block)
{
Console.WriteLine(block.Text);
break;
}
}
```
</Tab>
<Tab title="Go">
```go
client, err := bedrock.NewMantleClient(context.Background(), bedrock.MantleClientConfig{
AWSRegion: "us-east-1",
})
if err != nil {
panic(err)
}
message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
Model: "anthropic.claude-opus-5",
MaxTokens: 1024,
Messages: []anthropic.MessageParam{
anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
},
})
if err != nil {
panic(err)
}
for _, block := range message.Content {
if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
fmt.Println(textBlock.Text)
break
}
}
```
</Tab>
<Tab title="Java">
```java
import com.anthropic.bedrock.backends.BedrockMantleBackend;
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.models.messages.ContentBlock;
import com.anthropic.models.messages.Message;
import com.anthropic.models.messages.MessageCreateParams;
void main() {
AnthropicClient client = AnthropicOkHttpClient.builder()
.backend(BedrockMantleBackend.fromEnv())
.build();
Message message = client.messages().create(
MessageCreateParams.builder()
.model("anthropic.claude-opus-5")
.maxTokens(1024)
.addUserMessage("Hello, Claude")
.build()
);
message.content().stream()
.filter(ContentBlock::isText)
.findFirst()
.ifPresent(block -> IO.println(block.asText().text()));
}
```
</Tab>
<Tab title="PHP">
```php
use Anthropic\Bedrock\MantleClient;
$client = new MantleClient(awsRegion: 'us-east-1');
$message = $client->messages->create(
model: 'anthropic.claude-opus-5',
maxTokens: 1024,
messages: [
['role' => 'user', 'content' => 'Hello, Claude'],
],
);
echo array_find($message->content, fn ($block) => $block->type === 'text')->text;
Cut at 300 lines.