Claude on Amazon Bedrock: AWS Integration Guide
By Dorian Laurenceau
📅 Last reviewed: April 24, 2026. Updated with April 2026 findings and community feedback.
🔗 Pillar article: Claude API: Complete Guide
Why Claude on Bedrock?
If your infrastructure is already on AWS, Bedrock is the most natural way to integrate Claude. Here are the advantages:
| Advantage | Description |
|---|---|
| Unified billing | Claude appears on your existing AWS bill |
| Native IAM | Granular access control (who can use which model) |
| VPC | Requests stay within your private network |
| Compliance | SOC 2, HIPAA, FedRAMP, ISO 27001 |
| Guardrails | Integrated and configurable content filtering |
| No API key management | Uses standard AWS credentials |
| CloudWatch | Monitoring and alerts on usage |
Claude on Bedrock vs. Anthropic direct vs. the other clouds: the honest tradeoffs
The Bedrock-vs-direct conversation on r/aws, r/devops, r/ClaudeAI, and r/LocalLLaMA has stabilised around predictable tradeoffs. Here's what teams actually weigh.
When Bedrock is the right choice:
- →You're already on AWS with committed spend. AWS Savings Plans and existing enterprise discount programs can apply, and Bedrock invoicing folds into your existing AWS bill. Finance likes one vendor.
- →You need HIPAA, FedRAMP, SOC 2, or ISO 27001. The AWS compliance programs cover Bedrock. The AWS HIPAA eligibility page lists Bedrock explicitly.
- →You need VPC isolation. Bedrock with PrivateLink keeps traffic off the public internet. Anthropic's direct API is public by default.
- →You want one audit log. AWS CloudTrail captures all Bedrock calls alongside the rest of your AWS activity. Useful for regulated industries.
When direct Anthropic API is the right choice:
- →Access to the newest models first. Anthropic typically ships new models to their direct API before Bedrock. If you need frontier capabilities on day one, direct is faster.
- →Features like prompt caching and message batching arrive on direct first. Bedrock catches up but lags.
- →Simpler billing for individuals and small teams. A credit card and API key beats AWS IAM setup for most solo builders.
- →Lower minimum friction. For prototyping and early development, direct is faster.
Multi-cloud context:
- →Google Cloud Vertex AI also hosts Claude with similar enterprise posture. Pick the cloud you're already on.
- →Microsoft Azure AI Foundry hosts Claude alongside OpenAI models. Useful if you want both in one compliance envelope.
- →OpenRouter and LiteLLM let you abstract the cloud choice, so you can swap providers without code changes. Worth considering for teams that don't want long-term lock-in.
Operational gotchas the docs don't emphasise:
- →Region parity lags. Not all Claude models are in all AWS regions. Check the Bedrock model availability page before architecting.
- →Quotas are per-region, per-account. Heavy usage requires quota increase requests and lead time. Plan ahead.
- →Cross-region inference smooths capacity but changes latency and compliance footprint. Read Anthropic's Bedrock cross-region docs before enabling.
- →Prompt formats can diverge. Minor differences between Bedrock's wrapping and direct API wrapping. SDK abstractions handle this, but hand-rolled code needs care.
- →Bedrock Guardrails are AWS-native content filtering; they're good but they don't replace Anthropic's own safety work. Use both for regulated industries.
The honest framing: Bedrock vs. direct isn't really about quality; it's about compliance, procurement, and existing cloud commitments. Teams on AWS with real compliance needs go Bedrock; individuals and teams on prototypes go direct; multi-cloud shops use abstraction layers. None is universally correct. Match the choice to your actual constraints, not to what the marketing pages emphasise.
Setup: Step by Step
1. Enable Model Access
In the AWS console:
- →Navigate to Amazon Bedrock > Model access
- →Click Manage model access
- →Select the Anthropic models (Claude Opus, Sonnet, Haiku)
- →Submit the request (approval is usually instantaneous)
2. Configure IAM
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream"
],
"Resource": [
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-sonnet-4-20250514-v1:0",
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-opus-4-20250918-v1:0"
]
}
]
}
IAM best practices:
- →Use the principle of least privilege (one model per role)
- →Create specific roles per application
- →Add conditions (source IP, access hours)
- →Enable CloudTrail for auditing
3. Install the SDK
pip install boto3 anthropic[bedrock]
Code Examples
Basic Call with boto3
import boto3
import json
# Bedrock Runtime client
client = boto3.client(
service_name="bedrock-runtime",
region_name="us-east-1"
)
# Claude request
body = json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 1024,
"messages": [
{
"role": "user",
"content": "Explain the benefits of infrastructure as code."
}
]
})
response = client.invoke_model(
modelId="anthropic.claude-sonnet-4-20250514-v1:0",
contentType="application/json",
accept="application/json",
body=body
)
result = json.loads(response["body"].read())
print(result["content"][0]["text"])
With the Anthropic SDK (Recommended)
import anthropic
# Automatically uses AWS credentials
client = anthropic.AnthropicBedrock(
aws_region="us-east-1"
)
message = client.messages.create(
model="anthropic.claude-sonnet-4-20250514-v1:0",
max_tokens=1024,
messages=[
{"role": "user", "content": "What are the AWS services for machine learning?"}
]
)
print(message.content[0].text)
Streaming
import anthropic
client = anthropic.AnthropicBedrock(aws_region="us-east-1")
with client.messages.stream(
model="anthropic.claude-sonnet-4-20250514-v1:0",
max_tokens=2048,
messages=[{"role": "user", "content": "Write a microservices migration guide."}]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
Bedrock vs Direct API Pricing
| Model | Bedrock Input | Bedrock Output | Direct API Input | Direct API Output |
|---|---|---|---|---|
| Claude Opus 4.6 | $15.00/M | $75.00/M | $15.00/M | $75.00/M |
| Claude Sonnet 4 | $3.00/M | $15.00/M | $3.00/M | $15.00/M |
| Claude Haiku 3.5 | $0.80/M | $4.00/M | $0.80/M | $4.00/M |
Bedrock cost reduction options:
- →Provisioned Throughput: Guaranteed throughput, reduced pricing for high volumes
- →Batch Inference: Batch processing with 50% reduction
- →Cross-Region Inference: Automatic region optimization
Bedrock Guardrails
Bedrock guardrails add a configurable security layer around Claude.
# Call with guardrails
response = client.invoke_model(
modelId="anthropic.claude-sonnet-4-20250514-v1:0",
contentType="application/json",
accept="application/json",
body=body,
guardrailIdentifier="my-guardrail-id",
guardrailVersion="1"
)
| Guardrail Feature | Description |
|---|---|
| Content filters | Block inappropriate content |
| Denied topics | Forbid specific topics |
| Word filters | Block specific words or phrases |
| Sensitive info filters | Mask PII (names, emails, phone numbers) |
| Contextual grounding | Reduce hallucinations with sources |
Enterprise Architecture
Typical Architecture
Lambda + Claude
import json
import boto3
bedrock = boto3.client("bedrock-runtime")
def lambda_handler(event, context):
"""Lambda function calling Claude via Bedrock."""
user_question = event.get("question", "")
body = json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 1024,
"messages": [{"role": "user", "content": user_question}]
})
response = bedrock.invoke_model(
modelId="anthropic.claude-sonnet-4-20250514-v1:0",
body=body
)
result = json.loads(response["body"].read())
return {
"statusCode": 200,
"body": json.dumps({
"answer": result["content"][0]["text"],
"tokens_used": result["usage"]
})
}
Monitoring with CloudWatch
import boto3
cloudwatch = boto3.client("cloudwatch")
# Create an alarm on invocation count
cloudwatch.put_metric_alarm(
AlarmName="bedrock-claude-high-usage",
MetricName="Invocations",
Namespace="AWS/Bedrock",
Statistic="Sum",
Period=3600,
Threshold=10000,
ComparisonOperator="GreaterThanThreshold",
EvaluationPeriods=1,
AlarmActions=["arn:aws:sns:us-east-1:123456:alerts"],
Dimensions=[{
"Name": "ModelId",
"Value": "anthropic.claude-sonnet-4-20250514-v1:0"
}]
)
Available Metrics
| Metric | Description |
|---|---|
Invocations | Number of model calls |
InvocationLatency | Latency per request (ms) |
InputTokenCount | Input tokens consumed |
OutputTokenCount | Output tokens generated |
InvocationErrors | Number of errors (4xx, 5xx) |
Migrating from the Direct API
If you're already using the direct Anthropic API, migration to Bedrock is straightforward:
| Change | Direct API | Bedrock |
|---|---|---|
| Client | anthropic.Anthropic() | anthropic.AnthropicBedrock() |
| Auth | API key | AWS credentials (IAM) |
| Model ID | claude-sonnet-4-20250514 | anthropic.claude-sonnet-4-20250514-v1:0 |
| Endpoint | api.anthropic.com | bedrock-runtime.{region}.amazonaws.com |
| Rest of code | Identical | Identical |
# Before (Direct API)
# client = anthropic.Anthropic(api_key="sk-ant-...")
# model = "claude-sonnet-4-20250514"
# After (Bedrock)
client = anthropic.AnthropicBedrock(aws_region="us-east-1")
model = "anthropic.claude-sonnet-4-20250514-v1:0"
# The rest of the code is identical
message = client.messages.create(
model=model,
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}]
)
Module 0 — Prompting Fundamentals
Build your first effective prompts from scratch with hands-on exercises.
Dorian Laurenceau
Full-Stack Developer & Learning DesignerFull-stack web developer and learning designer. I spent 4 years as a freelance full-stack developer and 4 years teaching React, JavaScript, HTML/CSS and WordPress to adult learners. Today I design learning paths in web development and AI, grounded in learning science. I founded learn-prompting.fr to make AI practical and accessible, and built the Bluff app to gamify political transparency.
Weekly AI Insights
Tools, techniques & news — curated for AI practitioners. Free, no spam.
Free, no spam. Unsubscribe anytime.
→Related Articles
FAQ
What is Amazon Bedrock?+
Amazon Bedrock is an AWS service that provides access to foundational AI models (including Claude) via a unified API. It natively integrates with the AWS ecosystem (IAM, VPC, CloudWatch, S3).
Why use Claude via Bedrock instead of the direct API?+
Bedrock offers consolidated AWS billing, enterprise compliance (SOC2, HIPAA, FedRAMP), VPC integration for network security, native guardrails, and fine-grained IAM permission management.
How do I access Claude on Bedrock?+
Enable the Claude model in the Bedrock console (Model Access), configure IAM roles with bedrock:InvokeModel permissions, and use the boto3 SDK or your preferred AWS SDK.
Is Bedrock more expensive than the direct Anthropic API?+
Prices on Bedrock are generally similar or slightly higher than the direct API. However, Bedrock offers AWS billing options (Reserved Capacity, Savings Plans) that can reduce costs for high volumes.
What's the difference between AWS Bedrock and Claude's direct API?+
Bedrock offers unified AWS billing, built-in SOC2/HIPAA compliance, native guardrails, and compatibility with the AWS ecosystem (IAM, CloudWatch, S3). The direct API offers access to the latest features first, potentially lower prices, and simpler integration. Bedrock is recommended for enterprises already on AWS.