claude-on-amazon-bedrock-legacy changedbuild-with-claude/claude-on-amazon-bedrock-legacy
Nearest release: v2.1.232, published 7 hours before this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
## Install and configure the AWS CLI ## Install an SDK for accessing Bedrock ## Accessing Bedrock ### Subscribe to Anthropic models #### API model IDs ### List available models ### Making requests ### Bearer token authentication ## Activity logging ## Feature support ### Supported feature highlights ### Features not supported ### PDF support on Bedrock ### Mid-conversation system messages on Bedrock ### Context window ## Global versus regional endpoints ### When to use each option ### Implementation ## Additional resources
The whole hunk
1106 lines, first recordedThe first capture of this source. The page was already there, and this is what it said.
---
title: Claude on Amazon Bedrock (Opus 4.6 and earlier)
url: https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy
description: The legacy Amazon Bedrock integration for Claude models, using InvokeModel and Converse APIs with ARN-versioned model identifiers.
---
<Note>
This page covers the legacy Amazon Bedrock integration: the `InvokeModel` and `Converse` APIs with ARN-versioned model identifiers and AWS event-stream encoding. For models available on the Messages-API Bedrock endpoint, see [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock), which uses the Messages API at `/anthropic/v1/messages` with SSE streaming. For an Anthropic-operated alternative 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). Existing Bedrock users can follow the [migration guide](https://platform.claude.com/docs/en/build-with-claude/claude-platform-on-aws#migrating-from-amazon-bedrock).
</Note>
Calling Claude through Bedrock slightly differs from how you would call Claude on the Claude API directly. This guide walks you through completing an API call to Claude on Bedrock using one of Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview).
Note that this guide assumes you have already signed up for an [AWS account](https://portal.aws.amazon.com/billing/signup) and configured programmatic access.
## Install and configure the AWS CLI
1. [Install a version of the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) at or newer than version `2.13.23`.
2. Configure your AWS credentials using the AWS configure command (see [Configure the AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-configure.html)) or find your credentials by navigating to "Command line or programmatic access" within your AWS dashboard and following the directions in the modal window.
3. Verify that your credentials are working:
```bash AWS CLI
aws sts get-caller-identity
```
## Install an SDK for accessing Bedrock
Anthropic's [client SDKs](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) support Bedrock. You can also use an AWS SDK like `boto3` directly.
<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">
<CodeGroup>
```groovy Gradle
implementation("com.anthropic:anthropic-java-bedrock:2.53.0")
```
```xml Maven
<dependency>
<groupId>com.anthropic</groupId>
<artifactId>anthropic-java-bedrock</artifactId>
<version>2.53.0</version>
</dependency>
```
```java Java
import com.anthropic.client.AnthropicClient;
import com.anthropic.client.okhttp.AnthropicOkHttpClient;
import com.anthropic.bedrock.backends.BedrockBackend;
import com.anthropic.models.messages.MessageCreateParams;
import com.anthropic.models.messages.Message;
import com.anthropic.models.messages.Model;
public class BasicMessage {
public static void main(String[] args) {
AnthropicClient client = AnthropicOkHttpClient.builder()
.backend(BedrockBackend.fromEnv())
.build();
MessageCreateParams params = MessageCreateParams.builder()
.model(Model.CLAUDE_OPUS_4_6)
.maxTokens(1024L)
.addUserMessage("What is the capital of France?")
.build();
Message response = client.messages().create(params);
response.content().stream()
.flatMap(block -> block.text().stream())
.forEach(textBlock -> System.out.println(textBlock.text()));
}
}
```
</CodeGroup>
</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-bedrockruntime"
```
</Tab>
<Tab title="Boto3 (Python)">
```bash
pip install "boto3>=1.28.59"
```
</Tab>
</Tabs>
## Accessing Bedrock
### Subscribe to Anthropic models
Go to the [AWS Console > Bedrock > Model Access](https://console.aws.amazon.com/bedrock/home?region=us-west-2#/modelaccess) and request access to Anthropic models. Note that Anthropic model availability varies by region. See [AWS documentation](https://docs.aws.amazon.com/bedrock/latest/userguide/models-regions.html) for latest information.
#### API model IDs
<Note>
Claude Opus 5, Claude Sonnet 5, Claude Fable 5, Claude Opus 4.8, and Claude Opus 4.7 are reachable through `InvokeModel` on `bedrock-runtime`. These requests are served by the same infrastructure as the [Claude in Amazon Bedrock](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock) endpoint. For the native Messages API request shape and full feature parity, use that page. These models are omitted from the model table on this page because they do not have ARN-versioned model IDs.
</Note>
Lifecycle terms (Deprecated, Retired) are defined in [Model deprecations](https://platform.claude.com/docs/en/about-claude/model-deprecations). Lifecycle dates on partner-operated platforms are set by the partner and can differ from the Claude API schedule. For the current retirement date of any model on Amazon Bedrock, see [Amazon Bedrock's model lifecycle page](https://docs.aws.amazon.com/bedrock/latest/userguide/model-lifecycle.html).
AWS offers newer Claude models through [cross-region inference](https://docs.aws.amazon.com/bedrock/latest/userguide/cross-region-inference.html) rather than on-demand throughput. For these models, a request that passes the base model ID fails with an HTTP 400 error like the following:
```text wrap
Invocation of model ID anthropic.claude-sonnet-4-5-20250929-v1:0 with on-demand throughput isn't supported. Retry your request with the ID or ARN of an inference profile that contains this model.
```
To invoke these models, pass an inference profile instead of the base model ID. The inference profile ID is the base model ID with a prefix from a column marked "Yes" in the following table, for example us.anthropic.claude-sonnet-4-5-20250929-v1:0. You can also pass the full inference profile ARN, in the form `arn:aws:bedrock:{region}:{account-id}:inference-profile/{inference-profile-id}`. For AWS's authoritative list of available inference profiles, see [Supported Regions and models for inference profiles](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html). For how the prefixes affect routing and pricing, see the [Global versus regional endpoints](https://platform.claude.com/docs/en/build-with-claude/claude-on-amazon-bedrock-legacy#global-vs-regional-endpoints) section.
| Model | Base Bedrock model ID | `global` | `us` | `eu` | `jp` | `apac` |
| ---------------------------- | ----------------------------------------- | -------- | ---- | ---- | ---- | ------ |
| Claude Opus 4.6 | anthropic.claude-opus-4-6-v1 | Yes | Yes | Yes | Yes | Yes |
| Claude Sonnet 4.6 | anthropic.claude-sonnet-4-6 | Yes | Yes | Yes | Yes | No |
| Claude Sonnet 4.5 | anthropic.claude-sonnet-4-5-20250929-v1:0 | Yes | Yes | Yes | Yes | No |
| Claude Sonnet 4 Deprecated. | anthropic.claude-sonnet-4-20250514-v1:0 | Yes | Yes | Yes | No | Yes |
| Claude Sonnet 3.7 Retired. | anthropic.claude-3-7-sonnet-20250219-v1:0 | No | No | No | No | No |
| Claude Opus 4.5 | anthropic.claude-opus-4-5-20251101-v1:0 | Yes | Yes | Yes | No | No |
| Claude Opus 4.1 Deprecated. | anthropic.claude-opus-4-1-20250805-v1:0 | No | Yes | No | No | No |
| Claude Opus 4 Retired. | anthropic.claude-opus-4-20250514-v1:0 | No | No | No | No | No |
| Claude Haiku 4.5 | anthropic.claude-haiku-4-5-20251001-v1:0 | Yes | Yes | Yes | No | No |
| Claude Haiku 3.5 Deprecated. | anthropic.claude-3-5-haiku-20241022-v1:0 | No | Yes | No | No | No |
### List available models
The following examples show how to print a list of all the Claude models available through Bedrock:
<CodeGroup>
```bash AWS CLI
aws bedrock list-foundation-models --region=us-west-2 --by-provider anthropic --query "modelSummaries[*].modelId"
```
```python Boto3 (Python)
import boto3
bedrock = boto3.client(service_name="bedrock")
response = bedrock.list_foundation_models(byProvider="anthropic")
for summary in response["modelSummaries"]:
print(summary["modelId"])
```
```typescript TypeScript
import { BedrockClient, ListFoundationModelsCommand } from "@aws-sdk/client-bedrock";
const client = new BedrockClient({ region: "us-west-2" });
const command = new ListFoundationModelsCommand({ byProvider: "anthropic" });
const response = await client.send(command);
if (response.modelSummaries) {
for (const summary of response.modelSummaries) {
console.log(summary.modelId);
}
}
```
```csharp C#
using Amazon;
using Amazon.Bedrock;
using Amazon.Bedrock.Model;
var client = new AmazonBedrockClient(RegionEndpoint.USWest2);
var request = new ListFoundationModelsRequest
{
ByProvider = "anthropic"
};
var response = await client.ListFoundationModelsAsync(request);
foreach (var summary in response.ModelSummaries)
{
Console.WriteLine(summary.ModelId);
}
```
```go Go
import (
"context"
"fmt"
"log"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/service/bedrock"
)
// ...
cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion("us-west-2"))
if err != nil {
log.Fatal(err)
}
client := bedrock.NewFromConfig(cfg)
byProvider := "anthropic"
response, err := client.ListFoundationModels(context.TODO(), &bedrock.ListFoundationModelsInput{
ByProvider: &byProvider,
})
if err != nil {
log.Fatal(err)
}
for _, summary := range response.ModelSummaries {
fmt.Println(*summary.ModelId)
}
```
```java Java
import software.amazon.awssdk.regions.Region;
import software.amazon.awssdk.services.bedrock.BedrockClient;
import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsRequest;
import software.amazon.awssdk.services.bedrock.model.ListFoundationModelsResponse;
import software.amazon.awssdk.services.bedrock.model.FoundationModelSummary;
public class ListAnthropicModels {
public static void main(String[] args) {
BedrockClient client = BedrockClient.builder()
.region(Region.US_WEST_2)
.build();
ListFoundationModelsRequest request = ListFoundationModelsRequest.builder()
.byProvider("anthropic")
.build();
ListFoundationModelsResponse response = client.listFoundationModels(request);
for (FoundationModelSummary summary : response.modelSummaries()) {
System.out.println(summary.modelId());
}
client.close();
}
}
```
```php PHP
<?php
use Aws\Bedrock\BedrockClient;
$client = new BedrockClient([
'region' => 'us-west-2',
'version' => 'latest'
]);
$result = $client->listFoundationModels([
'byProvider' => 'anthropic'
]);
foreach ($result['modelSummaries'] as $summary) {
echo $summary['modelId'] . PHP_EOL;
}
```
```ruby Ruby
require "aws-sdk-bedrock"
client = Aws::Bedrock::Client.new(region: "us-west-2")
response = client.list_foundation_models({
by_provider: "anthropic"
})
response.model_summaries.each do |summary|
puts summary.model_id
end
```
</CodeGroup>
### Making requests
Cut at 300 lines. The page has the rest.
No line in this hunk matches that.