Amazon Bedrock is AWS's fully managed service for accessing multiple foundation models โ Anthropic's Claude, Meta's Llama, Amazon's own Titan and Nova models, and more โ through a single unified API. It sits at #11 among trending AI tags with roughly 4.7% usage share, appealing to teams already built on AWS who want model access without standing up their own GPU infrastructure. AWS handles scaling, security, and provisioning, so you call one API and swap the underlying model with a config change rather than a rewrite.
Bedrock is called through AWS's boto3 SDK. This example invokes Anthropic's Claude model through Bedrock's invoke_model API.
import boto3
import json
client = boto3.client("bedrock-runtime", region_name="us-east-1")
body = json.dumps({
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 200,
"messages": [{"role": "user", "content": "Explain S3 vs EBS in one paragraph."}]
})
response = client.invoke_model(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
body=body
)
result = json.loads(response["body"].read())
print(result["content"][0]["text"])
Enable model access in the Bedrock console for your AWS account, then call the API with the AWS CLI or boto3.
# 1. In the AWS Console: Bedrock -> Model access -> request access to a model
# 2. install boto3
pip install boto3
# 3. quick CLI test
aws bedrock-runtime invoke-model --model-id anthropic.claude-3-5-sonnet-20241022-v2:0 \
--body '{"anthropic_version":"bedrock-2023-05-31","max_tokens":100,"messages":[{"role":"user","content":"hi"}]}' \
output.json