aws-bedrock
AWS環境でAIを活用したいビジネスパーソン向けに、コンプライアンス対応やClaude、Llamaなどのモデル利用、RAGのための知識基盤構築、コンテンツ安全のためのガードレール適用などを容易にするSkill。
📜 元の英語説明(参考)
AWS Bedrock — fully managed foundation models on AWS infrastructure. Use when deploying AI in AWS-native environments, needing enterprise compliance (SOC2, HIPAA), running Claude, Llama, Titan, or Mistral on AWS, leveraging Knowledge Bases for RAG, or applying Guardrails for content safety.
🇯🇵 日本人クリエイター向け解説
AWS環境でAIを活用したいビジネスパーソン向けに、コンプライアンス対応やClaude、Llamaなどのモデル利用、RAGのための知識基盤構築、コンテンツ安全のためのガードレール適用などを容易にするSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o aws-bedrock.zip https://jpskill.com/download/14661.zip && unzip -o aws-bedrock.zip && rm aws-bedrock.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/14661.zip -OutFile "$d\aws-bedrock.zip"; Expand-Archive "$d\aws-bedrock.zip" -DestinationPath $d -Force; ri "$d\aws-bedrock.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
aws-bedrock.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
aws-bedrockフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
AWS Bedrock
概要
Amazon Bedrock は、複数のプロバイダー (Anthropic、Meta、Amazon、Mistral、Cohere) の基盤モデルへのアクセスを、統一された AWS API を通じて提供するフルマネージドサービスです。AWS IAM、VPC、CloudWatch、および S3 とネイティブに統合されているため、コンプライアンス、セキュリティ制御、および AWS ネイティブのデータパイプラインを必要とするエンタープライズワークロードに最適です。
セットアップ
pip install boto3
# Configure AWS credentials
aws configure
# Or set environment variables:
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION=us-east-1
AWS コンソールでモデルへのアクセスを有効にします: Bedrock → Model Access → Enable models
利用可能なモデル
| Model ID | プロバイダー | 最適な用途 |
|---|---|---|
anthropic.claude-3-5-sonnet-20241022-v2:0 |
Anthropic | 全体的な品質が最も優れています |
anthropic.claude-3-5-haiku-20241022-v1:0 |
Anthropic | 高速、費用対効果が高い |
anthropic.claude-3-opus-20240229-v1:0 |
Anthropic | 最も優れた推論能力 |
meta.llama3-70b-instruct-v1:0 |
Meta | オープンウェイト、Llama 3 70B |
meta.llama3-8b-instruct-v1:0 |
Meta | 高速、小型の Llama |
amazon.titan-text-express-v1 |
Amazon | AWS ネイティブのテキスト生成 |
mistral.mistral-large-2402-v1:0 |
Mistral | コード + 推論 |
cohere.command-r-plus-v1:0 |
Cohere | RAG、ツール利用 |
手順
Converse API (推奨)
Converse API は、すべての Bedrock モデルに対応した統一されたチャットインターフェースです。
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[
{"role": "user", "content": [{"text": "Explain AWS Lambda in simple terms."}]}
],
system=[{"text": "You are a helpful AWS solutions architect."}],
inferenceConfig={
"maxTokens": 1024,
"temperature": 0.7,
},
)
print(response["output"]["message"]["content"][0]["text"])
print(f"Input tokens: {response['usage']['inputTokens']}")
print(f"Output tokens: {response['usage']['outputTokens']}")
Converse を使用したストリーミング
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
response = bedrock.converse_stream(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[{"role": "user", "content": [{"text": "Write a Python quicksort implementation."}]}],
)
for event in response["stream"]:
if "contentBlockDelta" in event:
delta = event["contentBlockDelta"]["delta"]
if "text" in delta:
print(delta["text"], end="", flush=True)
print()
InvokeModel API (Raw)
Converse でまだサポートされていないモデル、または直接アクセスする場合:
import boto3
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
# Claude via InvokeModel
body = {
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What is the capital of France?"}
],
}
response = bedrock.invoke_model(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
body=json.dumps(body),
contentType="application/json",
accept="application/json",
)
result = json.loads(response["body"].read())
print(result["content"][0]["text"])
マルチモーダル — 画像分析
import boto3
import base64
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
# Read image
with open("diagram.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[
{
"role": "user",
"content": [
{
"image": {
"format": "png",
"source": {"bytes": base64.b64decode(image_b64)},
}
},
{"text": "Describe this architecture diagram and identify potential issues."},
],
}
],
)
print(response["output"]["message"]["content"][0]["text"])
ツール利用 (関数呼び出し)
import boto3
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
tools = [
{
"toolSpec": {
"name": "query_database",
"description": "Execute a SQL query against the production database",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"sql": {"type": "string", "description": "SQL query to execute"},
"database": {"type": "string", "description": "Database name"},
},
"required": ["sql"],
}
},
}
}
]
messages = [{"role": "user", "content": [{"text": "How many active users do we have?"}]}]
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=messages,
toolConfig={"tools": tools},
)
# Handle tool use
if response["stopReason"] == "tool_use":
tool_use = next(b for b in response["output"]["message"]["content"] if "toolUse" in b)
print(f"Tool: {tool_use['toolUse']['name']}")
print(f"Input: {tool_use['toolUse']['input']}")
# Return tool result
messages.append(response["output"]["message"])
messages.append({
"role": "user",
"content": [
{
"toolResult": {
"toolUseId": tool_use["toolUse"]["toolUseId"],
"content": [{"json": {"count": 12483, "active_last_30d": 8921}}],
}
}
],
})
final = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=messages,
toolConfig={"tools": tools},
)
print(final["output"]["message"]["content"][0]["text"])
RAG 用のナレッジベース
import boto3
# Knowled 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
AWS Bedrock
Overview
Amazon Bedrock is a fully managed service that provides access to foundation models from multiple providers (Anthropic, Meta, Amazon, Mistral, Cohere) through a unified AWS API. It integrates natively with AWS IAM, VPC, CloudWatch, and S3, making it ideal for enterprise workloads requiring compliance, security controls, and AWS-native data pipelines.
Setup
pip install boto3
# Configure AWS credentials
aws configure
# Or set environment variables:
export AWS_ACCESS_KEY_ID=...
export AWS_SECRET_ACCESS_KEY=...
export AWS_DEFAULT_REGION=us-east-1
Enable model access in the AWS Console: Bedrock → Model Access → Enable models
Available Models
| Model ID | Provider | Best For |
|---|---|---|
anthropic.claude-3-5-sonnet-20241022-v2:0 |
Anthropic | Best overall quality |
anthropic.claude-3-5-haiku-20241022-v1:0 |
Anthropic | Fast, cost-efficient |
anthropic.claude-3-opus-20240229-v1:0 |
Anthropic | Most capable reasoning |
meta.llama3-70b-instruct-v1:0 |
Meta | Open-weight, Llama 3 70B |
meta.llama3-8b-instruct-v1:0 |
Meta | Fast, smaller Llama |
amazon.titan-text-express-v1 |
Amazon | AWS-native text generation |
mistral.mistral-large-2402-v1:0 |
Mistral | Code + reasoning |
cohere.command-r-plus-v1:0 |
Cohere | RAG, tool use |
Instructions
Converse API (Recommended)
The Converse API is the unified chat interface for all Bedrock models:
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[
{"role": "user", "content": [{"text": "Explain AWS Lambda in simple terms."}]}
],
system=[{"text": "You are a helpful AWS solutions architect."}],
inferenceConfig={
"maxTokens": 1024,
"temperature": 0.7,
},
)
print(response["output"]["message"]["content"][0]["text"])
print(f"Input tokens: {response['usage']['inputTokens']}")
print(f"Output tokens: {response['usage']['outputTokens']}")
Streaming with Converse
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
response = bedrock.converse_stream(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[{"role": "user", "content": [{"text": "Write a Python quicksort implementation."}]}],
)
for event in response["stream"]:
if "contentBlockDelta" in event:
delta = event["contentBlockDelta"]["delta"]
if "text" in delta:
print(delta["text"], end="", flush=True)
print()
InvokeModel API (Raw)
For models not yet supported by Converse, or for direct access:
import boto3
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
# Claude via InvokeModel
body = {
"anthropic_version": "bedrock-2023-05-31",
"max_tokens": 1024,
"messages": [
{"role": "user", "content": "What is the capital of France?"}
],
}
response = bedrock.invoke_model(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
body=json.dumps(body),
contentType="application/json",
accept="application/json",
)
result = json.loads(response["body"].read())
print(result["content"][0]["text"])
Multi-Modal — Image Analysis
import boto3
import base64
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
# Read image
with open("diagram.png", "rb") as f:
image_b64 = base64.b64encode(f.read()).decode()
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[
{
"role": "user",
"content": [
{
"image": {
"format": "png",
"source": {"bytes": base64.b64decode(image_b64)},
}
},
{"text": "Describe this architecture diagram and identify potential issues."},
],
}
],
)
print(response["output"]["message"]["content"][0]["text"])
Tool Use (Function Calling)
import boto3
import json
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
tools = [
{
"toolSpec": {
"name": "query_database",
"description": "Execute a SQL query against the production database",
"inputSchema": {
"json": {
"type": "object",
"properties": {
"sql": {"type": "string", "description": "SQL query to execute"},
"database": {"type": "string", "description": "Database name"},
},
"required": ["sql"],
}
},
}
}
]
messages = [{"role": "user", "content": [{"text": "How many active users do we have?"}]}]
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=messages,
toolConfig={"tools": tools},
)
# Handle tool use
if response["stopReason"] == "tool_use":
tool_use = next(b for b in response["output"]["message"]["content"] if "toolUse" in b)
print(f"Tool: {tool_use['toolUse']['name']}")
print(f"Input: {tool_use['toolUse']['input']}")
# Return tool result
messages.append(response["output"]["message"])
messages.append({
"role": "user",
"content": [
{
"toolResult": {
"toolUseId": tool_use["toolUse"]["toolUseId"],
"content": [{"json": {"count": 12483, "active_last_30d": 8921}}],
}
}
],
})
final = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=messages,
toolConfig={"tools": tools},
)
print(final["output"]["message"]["content"][0]["text"])
Knowledge Bases for RAG
import boto3
# Knowledge Base RAG — Bedrock manages embedding and retrieval
bedrock_agent = boto3.client("bedrock-agent-runtime", region_name="us-east-1")
# Retrieve relevant documents
retrieve_response = bedrock_agent.retrieve(
knowledgeBaseId="KB123456789",
retrievalQuery={"text": "What is our refund policy?"},
retrievalConfiguration={
"vectorSearchConfiguration": {"numberOfResults": 5}
},
)
# Extract text from results
contexts = [r["content"]["text"] for r in retrieve_response["retrievalResults"]]
# Generate answer grounded in retrieved docs
retrieve_and_generate = bedrock_agent.retrieve_and_generate(
input={"text": "What is our refund policy?"},
retrieveAndGenerateConfiguration={
"type": "KNOWLEDGE_BASE",
"knowledgeBaseConfiguration": {
"knowledgeBaseId": "KB123456789",
"modelArn": "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0",
},
},
)
print(retrieve_and_generate["output"]["text"])
Guardrails for Content Safety
import boto3
bedrock = boto3.client("bedrock-runtime", region_name="us-east-1")
# Apply a guardrail to filter content
response = bedrock.converse(
modelId="anthropic.claude-3-5-sonnet-20241022-v2:0",
messages=[{"role": "user", "content": [{"text": "User's message here"}]}],
guardrailConfig={
"guardrailIdentifier": "my-guardrail-id",
"guardrailVersion": "DRAFT", # or "1", "2", etc.
"trace": "enabled",
},
)
# Check if content was blocked
if response.get("trace", {}).get("guardrail", {}).get("inputAssessment"):
print("Guardrail assessment:", response["trace"]["guardrail"])
IAM Policy for Bedrock
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"bedrock:InvokeModel",
"bedrock:InvokeModelWithResponseStream",
"bedrock:Converse",
"bedrock:ConverseStream"
],
"Resource": [
"arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-5-sonnet-20241022-v2:0"
]
}
]
}
Guidelines
- Use the Converse API for new integrations — it's model-agnostic and handles message formatting.
- Enable models in the AWS Console before first use — they are not enabled by default.
- Bedrock processes data in the selected AWS region — choose for data residency compliance.
- Knowledge Bases handle chunking, embedding, and retrieval automatically with OpenSearch Serverless.
- Guardrails can block harmful content, PII, and off-topic queries before they reach the model.
- Use
converse_streamfor user-facing features to reduce perceived latency. - Cross-region inference profiles let you automatically fall back to other regions if capacity is unavailable.
- Monitor costs with AWS Cost Explorer; tag Bedrock calls with application-specific tags.