Why not just call the API directly?
You can! Anthropic's API is great. But picture the conversation at a company that runs everything on AWS:
You: I want to add AI to the product.
Security team: Where does the data go?
Finance: Who do we pay? Is it on the AWS bill?
Ops: How do we control who can call it?
Bedrock answers all three with one sentence: "It's an AWS service." Your requests are signed with normal IAM credentials, run in an AWS region you pick, show up in CloudWatch, and land on the same invoice as your EC2 instances. Security goes back to sleep. Finance is happy. You get to build.
What Bedrock adds around the model
Bedrock is not only a pipe to Claude. It also offers managed extras you can switch on:
- Guardrails: filters for things you never want in or out (personal data, banned topics).
- Knowledge Bases: managed RAG. Point it at your documents and it handles the chunking, embeddings and search. (I wrote about how RAG works if you're curious.)
- Model choice: several model families behind one API surface, so switching or comparing is easier.
Hello, Claude (from AWS)
Here is a minimal TypeScript example using Anthropic's Bedrock SDK. It uses your normal AWS credentials (environment variables, a profile, or the role your Lambda runs with), so there's no Anthropic API key involved.
npm install @anthropic-ai/bedrock-sdk
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-5", // Bedrock model IDs start with "anthropic."
max_tokens: 1024,
messages: [{ role: "user", content: "Explain kiln drying to a five year old." }],
});
for (const block of message.content) {
if (block.type === "text") console.log(block.text);
}
That's it. If you've used the regular Anthropic SDK before, it's the same messages.create call. Only the client and the model ID change.
Gotchas I hit so you don't have to
- Check model access first. In the Bedrock console, make sure your account and region have access to the Claude models you want. "AccessDenied" on the very first call is almost always this, or IAM.
- Regions matter. Not every model is in every region. Pick the region first, then the model.
- IAM, least privilege. Give your app permission to invoke only the models it needs, not
bedrock:*on everything. Future you will be grateful. - Read the response properly.
contentis a list of blocks, not a string. Checkblock.typebefore reading.text. - Watch the cost of long prompts. If you send the same big system prompt every time, look into prompt caching. It's one of the easiest ways to cut cost.
When to pick Bedrock vs the direct API
| If you... | Lean towards | | --- | --- | | Run on AWS and want one bill, IAM and VPC controls | Bedrock | | Want managed RAG or guardrails without building them | Bedrock | | Want the newest API features on day one | Anthropic API directly | | Are not on AWS at all | Anthropic API directly |
There's no wrong answer, it's mostly about where the rest of your stack lives.
I recently finished Anthropic's Claude with Amazon Bedrock course, and the biggest lesson was this: the code is the easy 10%. Access, regions and permissions are the other 90%. Sort those out first and the fun part goes fast.
