Token导航 LogoToken导航TokenDH.com
AI 工具需要联网github未标认证来源可访问clear审计通过

bedrockbedrock 命令行

Agent Skill

bedrock 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

2,732

周安装

115

GitHub Stars

1,084

下载量

957
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bedrock(bedrock 命令行)
来源仓库:https://github.com/itsmostafa/aws-agent-skills
仓库路径:skills/bedrock
安装命令:
npx skills add https://github.com/itsmostafa/aws-agent-skills --skill bedrock
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/itsmostafa/aws-agent-skills --skill bedrock

简介

提供对 Amazon Bedrock 上各类基础模型的统一访问接口,支持文本、嵌入与图像生成。

  • 适用于构建生成式 AI 应用,集成 Claude、Titan、Llama 等多种前沿模型能力。
  • 通过 CLI 工具管理模型调用、参数配置与推理任务,简化多模型协作流程。
  • 使用前需配置 AWS 凭证与区域设置,确保权限范围覆盖所需服务与资源。
  • bedrock 属于AI 工具类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

AWS Bedrock

Amazon Bedrock provides access to foundation models (FMs) from AI companies through a unified API. Build generative AI applications with text generation, embeddings, and image generation capabilities.

Table of Contents

Core Concepts

Foundation Models

Pre-trained models available through Bedrock:

  • Claude (Anthropic): Text generation, analysis, coding
  • Titan (Amazon): Text, embeddings, image generation
  • Llama (Meta): Open-weight text generation
  • Mistral: Efficient text generation
  • Stable Diffusion (Stability AI): Image generation

Model Access

Models must be enabled in your account before use:

  • Request access in Bedrock console
  • Some models require acceptance of EULAs
  • Access is region-specific

Inference Types

TypeUse CasePricing
On-DemandVariable workloadsPer token
Provisioned ThroughputConsistent high-volumeHourly commitment
Batch InferenceAsync large-scaleDiscounted per token

Common Patterns

Invoke Model (Text Generation)

AWS CLI:

# Invoke Claude
aws bedrock-runtime invoke-model \
  --model-id anthropic.claude-3-sonnet-20240229-v1:0 \
  --content-type application/json \
  --accept application/json \
  --body '{
    "anthropic_version": "bedrock-2023-05-31",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain AWS Lambda in 3 sentences."}
    ]
  }' \
  response.json

cat response.json | jq -r '.content[0].text'

boto3:

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def invoke_claude(prompt, max_tokens=1024):
    response = bedrock.invoke_model(
        modelId='anthropic.claude-3-sonnet-20240229-v1:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': max_tokens,
            'messages': [
                {'role': 'user', 'content': prompt}
            ]
        })
    )

    result = json.loads(response['body'].read())
    return result['content'][0]['text']

# Usage
response = invoke_claude('What is Amazon S3?')
print(response)

Streaming Response

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def stream_claude(prompt):
    response = bedrock.invoke_model_with_response_stream(
        modelId='anthropic.claude-3-sonnet-20240229-v1:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': 1024,
            'messages': [
                {'role': 'user', 'content': prompt}
            ]
        })
    )

    for event in response['body']:
        chunk = json.loads(event['chunk']['bytes'])
        if chunk['type'] == 'content_block_delta':
            yield chunk['delta'].get('text', '')

# Usage
for text in stream_claude('Write a haiku about cloud computing.'):
    print(text, end='', flush=True)

Generate Embeddings

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

def get_embedding(text):
    response = bedrock.invoke_model(
        modelId='amazon.titan-embed-text-v2:0',
        contentType='application/json',
        accept='application/json',
        body=json.dumps({
            'inputText': text,
            'dimensions': 1024,
            'normalize': True
        })
    )

    result = json.loads(response['body'].read())
    return result['embedding']

# Usage
embedding = get_embedding('AWS Lambda is a serverless compute service.')
print(f'Embedding dimension: {len(embedding)}')

Conversation with History

import boto3
import json

bedrock = boto3.client('bedrock-runtime')

class Conversation:
    def __init__(self, system_prompt=None):
        self.messages = []
        self.system = system_prompt

    def chat(self, user_message):
        self.messages.append({
            'role': 'user',
            'content': user_message
        })

        body = {
            'anthropic_version': 'bedrock-2023-05-31',
            'max_tokens': 1024,
            'messages': self.messages
        }

        if self.system:
            body['system'] = self.system

        response = bedrock.invoke_model(
            modelId='anthropic.claude-3-sonnet-20240229-v1:0',
            contentType='application/json',
            accept='application/json',
            body=json.dumps(body)
        )

        result = json.loads(response['body'].read())
        assistant_message = result['content'][0]['text']

        self.messages.append({
            'role': 'assistant',
            'content': assistant_message
        })

        return assistant_message

# Usage
conv = Conversation(system_prompt='You are an AWS solutions architect.')
print(conv.chat('What database should I use for a chat application?'))
print(conv.chat('What about for time-series data?'))

List Available Models

# List all foundation models
aws bedrock list-foundation-models \
  --query 'modelSummaries[*].[modelId,modelName,providerName]' \
  --output table

# Filter by provider
aws bedrock list-foundation-models \
  --by-provider anthropic \
  --query 'modelSummaries[*].modelId'

# Get model details
aws bedrock get-foundation-model \
  --model-identifier anthropic.claude-3-sonnet-20240229-v1:0

Request Model Access

# List model access status
aws bedrock list-foundation-model-agreement-offers \
  --model-id anthropic.claude-3-sonnet-20240229-v1:0

CLI Reference

Bedrock (Control Plane)

CommandDescription
aws bedrock list-foundation-modelsList available models
aws bedrock get-foundation-modelGet model details
aws bedrock list-custom-modelsList fine-tuned models
aws bedrock create-model-customization-jobStart fine-tuning
aws bedrock list-provisioned-model-throughputsList provisioned capacity

Bedrock Runtime (Data Plane)

CommandDescription
aws bedrock-runtime invoke-modelInvoke model synchronously
aws bedrock-runtime invoke-model-with-response-streamInvoke with streaming
aws bedrock-runtime converseMulti-turn conversation API
aws bedrock-runtime converse-streamStreaming conversation

Bedrock Agent Runtime

CommandDescription
aws bedrock-agent-runtime invoke-agentInvoke a Bedrock agent
aws bedrock-agent-runtime retrieveQuery knowledge base
aws bedrock-agent-runtime retrieve-and-generateRAG query

Best Practices

Cost Optimization

  • Use appropriate models: Smaller models for simple tasks
  • Set max_tokens: Limit output length when possible
  • Cache responses: For repeated identical queries
  • Batch when possible: Use batch inference for bulk processing
  • Monitor usage: Set up CloudWatch alarms for cost

Performance

  • Use streaming: For better user experience with long outputs
  • Connection pooling: Reuse boto3 clients
  • Regional deployment: Use closest region to reduce latency
  • Provisioned throughput: For consistent high-volume workloads

Security

  • Least privilege IAM: Only grant needed model access
  • VPC endpoints: Keep traffic private
  • Guardrails: Implement content filtering
  • Audit with CloudTrail: Track model invocations

IAM Permissions

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "bedrock:InvokeModel",
        "bedrock:InvokeModelWithResponseStream"
      ],
      "Resource": [
        "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0",
        "arn:aws:bedrock:us-east-1::foundation-model/amazon.titan-embed-text-v2:0"
      ]
    }
  ]
}

Troubleshooting

AccessDeniedException

Causes:

  • Model access not enabled in console
  • IAM policy missing bedrock:InvokeModel
  • Wrong model ID or region

Debug:

# Check model access status
aws bedrock list-foundation-models \
  --query 'modelSummaries[?modelId==`anthropic.claude-3-sonnet-20240229-v1:0`]'

# Test IAM permissions
aws iam simulate-principal-policy \
  --policy-source-arn arn:aws:iam::123456789012:role/my-role \
  --action-names bedrock:InvokeModel \
  --resource-arns "arn:aws:bedrock:us-east-1::foundation-model/anthropic.claude-3-sonnet-20240229-v1:0"

ModelNotReadyException

Cause: Model is still being provisioned or temporarily unavailable.

Solution: Implement retry with exponential backoff:

import time
from botocore.exceptions import ClientError

def invoke_with_retry(bedrock, body, max_retries=3):
    for attempt in range(max_retries):
        try:
            return bedrock.invoke_model(
                modelId='anthropic.claude-3-sonnet-20240229-v1:0',
                body=json.dumps(body)
            )
        except ClientError as e:
            if e.response['Error']['Code'] == 'ModelNotReadyException':
                time.sleep(2 ** attempt)
            else:
                raise
    raise Exception('Max retries exceeded')

ThrottlingException

Causes:

  • Exceeded on-demand quota
  • Too many concurrent requests

Solutions:

  • Request quota increase
  • Implement exponential backoff
  • Consider provisioned throughput

ValidationException

Common issues:

  • Invalid model ID
  • Malformed request body
  • max_tokens exceeds model limit

Debug:

# Check model-specific requirements
aws bedrock get-foundation-model \
  --model-identifier anthropic.claude-3-sonnet-20240229-v1:0 \
  --query 'modelDetails.inferenceTypesSupported'

References

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenCode

29.32%
按下载量换算281

Claude Code

23.1%
按下载量换算221

Antigravity

19.28%
按下载量换算185

Codex

11.74%
按下载量换算112

Cursor

8.19%
按下载量换算78

Gemini CLI

3.05%
按下载量换算29

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills