Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · api

claude-in-amazon-bedrock changedbuild-with-claude/claude-in-amazon-bedrock

Nearest release: v2.1.328, published 7 hours after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Recorded here
Lines+78added
Lines−34removed
From line 55 where the diff opens
First seen 14 Aug 2026 this site's first read of the page
Recorded edits56to this page, all time

#### Block long-term bearer tokens

The whole hunk

from line 55, old and new numbered
/
lines
from line 55
5555 
5656### Bearer tokens
5757 
58For short-term access without IAM roles (12-hour maximum, least preferred):
58A bearer token lets you call the endpoint without signing requests with AWS credentials. AWS calls this token an Amazon Bedrock API key. AWS recommends signing with temporary AWS credentials whenever possible, so bearer tokens are the least preferred of the three authentication paths. Use a bearer token when your software can’t sign requests.
5959 
60Bearer tokens come in two types:
61 
62| Aspect | Short-term | Long-term |
63| --------------- | -------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
64| **Lifetime** | Up to 12 hours, or until the AWS session that generated it ends, whichever comes first | Until its expiration date. If it has none, it never expires. |
65| **Permissions** | Those of the IAM identity that generated it | Those of the IAM user that it belongs to |
66| **Notes** | Works only in the AWS region where you generate it | Recommended by AWS only for exploration |
67 
68For either type, the IAM identity whose permissions the token carries needs the `bedrock-mantle:CallWithBearerToken` and `bedrock-mantle:CreateInference` permissions.
69 
70To use a bearer token:
71 
6072<Steps>
61 <Step title="Admin: restrict token types">
62 Block long-term keys by attaching a policy that denies `bedrock:CallWithBearerToken` unless the `bedrock:BearerTokenType` condition matches a short-term token.
73 <Step title="Generate the token">
74 Generate either type in the Amazon Bedrock console. You can also generate a short-term token with one of AWS’s token generator libraries. For instructions, see [API keys](https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys.html) in the Amazon Bedrock User Guide.
6375 </Step>
6476 
65 <Step title="Developer: mint a token">
66 Use the `aws-bedrock-token-generator` CLI to mint a bearer token. Pass it in the `x-api-key` header on each request.
77 <Step title="Send the token">
78 How you send the token depends on how you call the endpoint:
79 
80 * **With the SDK:** Set the `AWS_BEARER_TOKEN_BEDROCK` environment variable. For how the client finds credentials, see [Making your first request](https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock#making-your-first-request).
81 * **With direct HTTP requests:** Instead of signing each request, pass the token in the `x-api-key` header or as `Authorization: Bearer <token>`. Leave out the request-signing parts, such as the `x-amz-security-token` header and cURL’s `--aws-sigv4` and `-u` options.
6782 </Step>
6883</Steps>
6984 
85#### Block long-term bearer tokens
86 
87An administrator can stop IAM users from calling Amazon Bedrock with long-term tokens. A token works on both Amazon Bedrock endpoints, and each endpoint has its own IAM action and condition key:
88 
89| Endpoint | Action to deny | Condition key |
90| ----------------- | ------------------------------------ | -------------------------------- |
91| `bedrock-mantle` | `bedrock-mantle:CallWithBearerToken` | `bedrock-mantle:bearerTokenType` |
92| `bedrock-runtime` | `bedrock:CallWithBearerToken` | `bedrock:bearerTokenType` |
93 
94Write a policy with one Deny statement for each endpoint. In each statement, set `Resource` to `*`, and use `StringEquals` to require that the condition key equals `LONG_TERM`.
95 
96Where you attach the policy determines which tokens it blocks:
97 
98* **One IAM user:** It blocks that user’s tokens. The Amazon Bedrock console creates a new IAM user for each long-term token, so this misses tokens generated there later.
99* **A member account in AWS Organizations:** As a service control policy (SCP), it blocks the tokens of every IAM user in the account, including new users.
100 
101The policy blocks using long-term tokens, not generating them. For a sample of this policy and for policies that control generation, see [Control permissions for generating and using Amazon Bedrock API keys](https://docs.aws.amazon.com/bedrock/latest/userguide/api-keys-permissions.html) in the Amazon Bedrock User Guide.
102 
70103## Install an SDK
71104 
72105The [client SDK](https://platform.claude.com/docs/en/cli-sdks-libraries/overview) supports Claude in Amazon Bedrock through a Bedrock-specific package or module.
from line 163
130163 
131164 <Tab title="Ruby">
132165 ```bash
133 # Gemfile
134 gem "anthropic"
135 gem "aws-sdk-core"
166 bundle add anthropic
167 bundle add aws-sdk-core
136168 ```
137169 </Tab>
138170</Tabs>
from line 264
232264 
233265 <Tab title="Go">
234266 ```go
235 client, err := bedrock.NewMantleClient(context.Background(), bedrock.MantleClientConfig{
236 AWSRegion: "us-east-1",
237 })
238 if err != nil {
239 panic(err)
240 }
267 import (
268 "context"
269 "fmt"
241270 
242 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
243 Model: "anthropic.claude-opus-5-5",
244 MaxTokens: 1024,
245 Messages: []anthropic.MessageParam{
246 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
247 },
248 })
249 if err != nil {
250 panic(err)
251 }
271 "github.com/anthropics/anthropic-sdk-go/v2"
272 "github.com/anthropics/anthropic-sdk-go/v2/bedrock"
273 )
252274 
253 for _, block := range message.Content {
254 if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
255 fmt.Println(textBlock.Text)
256 break
275 func main() {
276 client, err := bedrock.NewMantleClient(
277 context.Background(),
278 bedrock.MantleClientConfig{AWSRegion: "us-east-1"},
279 )
280 if err != nil {
281 panic(err)
257282 }
283 
284 message, err := client.Messages.New(context.Background(), anthropic.MessageNewParams{
285 Model: "anthropic.claude-opus-5-5",
286 MaxTokens: 1024,
287 Messages: []anthropic.MessageParam{
288 anthropic.NewUserMessage(anthropic.NewTextBlock("Hello, Claude")),
289 },
290 })
291 if err != nil {
292 panic(err)
293 }
294 
295 for _, block := range message.Content {
296 if textBlock, ok := block.AsAny().(anthropic.TextBlock); ok {
297 fmt.Println(textBlock.Text)
298 break
299 }
300 }
258301 }
259302 ```
260303 </Tab>
from line 362
319362 messages: [{role: "user", content: "Hello, Claude"}]
320363 )
321364 
322 puts message.content.find { it.type == :text }.text
365 text_block = message.content.grep(Anthropic::Models::TextBlock).first
366 puts text_block.text if text_block
323367 ```
324368 </Tab>
325369</Tabs>
from line 466
422466 
423467## Data retention
424468 
425Data handling for this offering is governed by Amazon Bedrock. For details, see [Data protection in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/data-protection.html).
469Amazon Bedrock governs data handling for Claude in Amazon Bedrock. For details, see [Data protection in Amazon Bedrock](https://docs.aws.amazon.com/bedrock/latest/userguide/data-protection.html).
426470 
427471## Monitoring and logging
428472 
Feedback