在 AWS 上监控和审计 AI 工作负载
简介
AWS 上的现代 AI 工作负载跨三个独立管道生成遥测数据 — CloudTrail(谁调用了什么)、Bedrock Model Invocation Logging(模型说了什么)和 ADOT SDK 收集的 Agent Telemetry(Agent 表现如何)。每个管道都必不可少。CloudTrail 本身可以告诉您某个 IAM 角色调用了 InvokeModel,但无法告诉您该角色向模型提了什么问题或 Agent 如何响应。Model Invocation Logging 捕获内容但不捕获 Agent 编排。ADOT 捕获编排但不捕获推理参数或 IAM 身份。安全和运营调查几乎总是需要关联至少两个管道。
本指南向您展示如何通过以下方式为 AI 工作负载构建完整的监控和审计方案:
- 启用所有三个遥测管道 — 本指南中提供简要设置,并附有指向配套指南的深层链接以了解详情。
- 在 CloudTrail 上构建检测规则 — 用于安全和审计面的 metric 过滤器、告警和 Contributor Insights 规则,涵盖 Bedrock 和 AgentCore 数据事件。
- 运行跨管道关联查询 — 将 CloudTrail 与 Bedrock Model Invocation Logging 和 ADOT spans 连接,以回答单个管道无法独自回答的问题。
Generative AI Security Scoping Matrix 和 Agentic AI Security Scoping Matrix 定义了组织在构建 AI 应用程序时需要解决的安全维度,包括审计和日志记录、身份上下文、Agent 权限边界和数据保护。本指南使用 CloudTrail、CloudWatch 和跨管道关联为这些维度提供具体实现。下面的标签页将每个矩阵维度映射到实现它的指南章节。
- Agentic AI
- Generative AI
| Dimension | Guide Sections |
|---|---|
| Governance & Compliance — data sovereignty, audit | Model Invocation Logging, Query 18, Query 25, Metric Filter 5, Metric Filter 23 |
| Risk Management — threat modeling, guardrails | Bedrock Guardrail monitoring, Query 8, Query 21, Query 27, Metric Filter 4, Metric Filter 25 |
| Controls — identity, access management, least privilege | Management Events, Query 1, Query 2, Query 4, Metric Filter 1, Metric Filter 7 |
AWS 负责运行 CloudTrail、CloudWatch 和 Bedrock 服务的云基础设施的安全性。客户负责云中的安全性,包括配置事件选择器、创建检测规则、设置告警阈值以及响应安全事件。本指南重点介绍 AI 工作负载的客户配置和监控职责。有关更多信息,请参阅 AWS Shared Responsibility Model。
三重叠加挑战
数据量 — AI 模型调用可能产生大量事 件。如果没有精确的事件选择器和聚合,在高数据量下很难隔离感兴趣的事件,而且捕获所有事件的成本过高。
速度 — Agent 发起的活动序列可能在几秒钟内涉及多个 API 调用、工具调用和模型交互。近实时检测规则有助于在异常发生时更快地浮现运营异常,支持更快的分类和更短的平均调查时间。
复杂性 — AI 工作负载活动跨越多个 AWS 服务。没有任何单一 log 源能提供完整的可见性。跨管道关联才是调查真正发生的地方。
本指南涵盖的内容
- 三个遥测管道及其各自独特捕获的内容
- 所有三个管道的启用方法(CloudTrail 深入讲解;其他两个提供简要步骤和深层链接)
- CloudTrail 专属检测:metric 过滤器、告警、Contributor Insights,涵盖 Bedrock 和 AgentCore 数据事件
- AgentCore 数据事件:网关流量、内置工具使用、凭证访问、内存操作和运行时活动
- 用于调查的跨管道关联查询
- 结合所有三个数据源的统一 dashboard
GenAI 遥测全景:三条互补管道
CloudTrail 是三条遥测管道之一,它们共同为 AWS 上的 AI 工作负载提供完整的可观测性。每条管道捕获不同的数据,服务于不同的目的,并以不同的方式启用。安全调查几乎总是需要关联至少两条管道。

| Pipeline | Captures | Log Group | Primary Use |
|---|---|---|---|
| CloudTrail | Who did what — every API call, caller ARN, source IP, error codes, access denials, control-plane changes | YOUR_CLOUDTRAIL_LOG_GROUP | Security audit, access investigation, configuration change tracking |
| Bedrock Model Invocation Logging | What the model said — full prompt, full response, inference parameters (temperature, max_tokens), caller IAM identity, token counts | bedrock-model-invocation-logging | Content audit, compliance, prompt quality debugging, cost attribution |
| Agent Telemetry (collected by AWS Distro for OpenTelemetry — ADOT) | How the agent performed — model call latency, tool execution, distributed trace correlation, session tracking | aws/spans, /aws/bedrock-agentcore/runtimes/<agent> | Operational monitoring, performance debugging, agent workflow 可观测性 |
每条管道独自能回答什么
CloudTrail 单独告诉您:
- 哪个 IAM 身份调用了
InvokeModel? - 源 IP、用户代理和区域是什么?
- 调用是否被拒绝(AccessDenied、UnauthorizedOperation)?
- 是否有人修改了 Guardrail、停止了日志记录或提升了 IAM 权限?
- 哪个 VPC 端点阻 止了调用?
Model Invocation Logging 单独告诉您:
- 向模型发送了什么 prompt?
- 模型返回了什么?
- 使用了什么 temperature 和 max_tokens?
- 调用消耗了多少输入和输出 token?
- 响应是否被截断(stop_reason = max_tokens)?
Agent Telemetry(ADOT SDK)单独告诉您:
- 模型调用花了多长时间(客户端延迟)?
- Agent 调用了哪些工具,顺序是什么?
- 工具是否失败了,哪个组件导致了错误?
- Agent 会话如何在多次模型调用之间链接?
关联如何解锁调查
只有关联才能回答的问题
| Investigation Question | Pipelines to Join | Join Key |
|---|---|---|
| Who asked the model this question, and what did it say? | CloudTrail (caller) + Model Invocation Logging (prompt/response) | requestId |
| Did the agent fail because of a model issue, a tool issue, or a permission issue? | ADOT spans (component latency/errors) + CloudTrail (AccessDenied events) | session + time |
| Was a guardrail weakened just before these unsafe model responses? | CloudTrail (UpdateGuardrail events) + Model Invocation Logging (response content) | timestamp |
| Is the agent role making Bedrock calls that violate least privilege? | CloudTrail (cross-service AccessDenied from assumed role) + ADOT (agent session ID) | session + time |
| Which external caller triggered this agent through the Gateway, and what credentials did the agent use? | CloudTrail Gateway data events (JWT subject, source IP) + CloudTrail credential data events (TokenVault/OAuth2 access) | time + agent runtime ARN |
| Is an agent executing code or browsing websites outside its intended scope? | CloudTrail AgentCore tool data events (CodeInterpreter/Browser) + ADOT spans (agent session context) | session + time |
跨管道关联查询章节为您提供这些场景的实际 JOIN 查询。 :::
实施概述
分阶段推出,先启用所有三条管道,然后在其上叠加检测和关联。
第 1 阶段:启用可观测性管道
首先启用两条可观测性管道(Bedrock Model Invocation Logging 和 ADOT SDK 收集的 Agent Telemetry)。它们启用速度快,而且是关联查询得以实现的基础。CloudTrail 设置在第 2 阶段进行。
管道 A:Bedrock Model Invocation Logging
捕获每次 Bedrock 模型调用的完整 prompt、响应、推理参数和调用者 IAM 身份。需要手动选择启用。(通过捕获模型交互来支持数据主权要求和合规审计工作流,实现 Generative AI Security Scoping Matrix 的 Governance & Compliance 维度。)
- 打开 Amazon Bedrock 控制台
- 选择 Settings → Model invocation logging
- 启用日志记录并选择 CloudWatch Logs(和/或 S3)作为目标
- 配置 log group 名称(默认:
bedrock-model-invocation-logging)和服务角色
有关详细配置、PII 脱敏和 dashboard 设置,请参阅 GenAI 可观测性 on AWS。
管道 B:Agent Telemetry(由 ADOT SDK 收集)
捕获 Agent 编排、分布式 traces 和工具执行。
- AgentCore: 无需操作,因为 ADOT SDK 默认包含在运行时中,遥测数据自动流向
aws/spans和/aws/bedrock-agentcore/runtimes/<agent> - EKS/ECS/自托管: 将 ADOT 自动插桩 Agent 附加到您的工作负载。无需代码更改
启用 CloudWatch Transaction Search 以解锁完整的 Application Signals 体验。
有关详细启用步骤,请参阅 GenAI 可观测性 on AWS — 为 Agentic 工作负载启用可观测性 和 AgentCore 可观测性快速入门。
第 2 阶段:启用 CloudTrail — 从 Bedrock 开始,扩大覆盖范围,导入 CloudWatch
配置 CloudTrail 以捕获完整的 AI 工作负载审计面,从最高价值的资源(Bedrock)开始向外扩展。将所有数据传送到 CloudWatch Logs,以便与管道 A 和 B 进行关联。
步骤 1:Bedrock 和 AgentCore 数据事件及管理事件
使用高级事件选择器在您的 trail 上启用 Bedrock 数据事件。这些操作默认不会被记录。请参阅 Amazon Bedrock 数据事件。
| Category | Resource Types |
|---|---|
| Agent & Orchestration | AWS::Bedrock::AgentAlias, AWS::Bedrock::InlineAgent, AWS::Bedrock::FlowAlias, AWS::Bedrock::FlowExecution, AWS::Bedrock::Session |
| Model Invocation | AWS::Bedrock::Model, AWS::Bedrock::AsyncInvoke, AWS::Bedrock::PromptVersion, AWS::Bedrock::AdvancedOptimizePromptJob |
| Safety & Guardrails | AWS::Bedrock::Guardrail, AWS::Bedrock::AutomatedReasoningPolicy, AWS::Bedrock::AutomatedReasoningPolicyVersion |
| Knowledge & RAG | AWS::Bedrock::KnowledgeBase, AWS::Bedrock::Tool |
| Data Automation | AWS::Bedrock::DataAutomationProject, AWS::Bedrock::DataAutomationInvocation, AWS::Bedrock::DataAutomationProfile, AWS::Bedrock::Blueprint |
使用高级事件选择器启用 AgentCore 数据事件。请参阅 Amazon Bedrock AgentCore 数据事件。
| Category | Resource Types |
|---|---|
| Runtime & Gateway | AWS::BedrockAgentCore::Gateway, AWS::BedrockAgentCore::Runtime, AWS::BedrockAgentCore::RuntimeEndpoint |
| Built-in Tools | AWS::BedrockAgentCore::CodeInterpreter, AWS::BedrockAgentCore::Browser |
| Identity & Credentials | AWS::BedrockAgentCore::WorkloadIdentity, AWS::BedrockAgentCore::TokenVault, AWS::BedrockAgentCore::OAuth2CredentialProvider, AWS::BedrockAgentCore::APIKeyCredentialProvider |
| Memory & Evaluation | AWS::BedrockAgentCore::Memory, AWS::BedrockAgentCore::Evaluator |
以及其他 AgentCore 资源类型(随着其可用性增加)。
验证管理事件(读和写)已在所有区域启用 — 这会自动将 InvokeModel 和 Converse 作为管理事件捕获,以及 AgentCore 管理事件如 CreateGateway、CreateGatewayTarget 等。请参阅 CloudTrail 管理事件。
启用 CloudTrail Insights(ApiCallRateInsight 和 ApiErrorRateInsight)以进行异常检测。请参阅 CloudTrail Insights 事件。
步骤 2:扩展到 S3、Lambda 和网络活动
- 为训练数据、模型制品和 CI/CD 管道存储桶启用 Amazon S3 数据事件(仅写入)。请参阅 Amazon S3 和 Lambda 数据事件。
- 为生产 AI 管道函数启用 Lambda 数据事件,排除开发/测试函数。请参阅 Amazon S3 和 Lambda 数据事件。
- 为 Bedrock、S3 和 Lambda VPC 端点启用网络活动事件,针对
VpceAccessDenied。请参阅 CloudTrail 网络活动事件。
步骤 3:传送到 CloudWatch Logs
- 配置您的 CloudTrail trail 以传送到 CloudWatch Logs log group。
第 3 阶段:在 CloudTrail 上构建检测规则
- 为 CloudTrail 事件创建 metric 过滤器(未授权的 Bedrock 访问、Guardrail 变更、日志中断)。请参阅 Metric 过滤器。
- 在每个 metric 过滤器上创建 CloudWatch Alarms 并配置 SNS 通知目标。请参阅 CloudWatch Alarms。
- 创建 Contributor Insights 规则以识别排名靠前的 IAM 身份和源 IP。请参阅 Contributor Insights 规则。
第 4 阶段:构建跨管道关联查询
- 开发 CloudWatch Logs Insights 查询用于标准 CloudTrail 检测。请参阅安全分析。
- 构建跨管道 JOIN 查询,将 CloudTrail 与 Bedrock Model Invocation Logging 和 ADOT spans 结合。请参阅跨管道关联查询。
- 保存经过验证的查询,供安全和运营分析师反复使用。
第 5 阶段:通过事件聚合进行优化
- 启用 CloudTrail 事件聚合(
API_ACTIVITY、RESOURCE_ACCESS、USER_ACTIONS模板)以在原始数据事件旁提供 5 分钟摘要。请参阅 CloudTrail 数据事件聚合。 - 使用 CloudWatch Subscription Filters 仅将管理事件和聚合事件转发到下游 SIEM,减少摄入量。
第 6 阶段:组装统一 Dashboard
- 构建一个 CloudWatch Dashboard,将 CloudTrail 告警、Contributor Insights 小组件、Model Invocation Log 成本小组件、ADOT 性能小组件和关联查询结果整合到单一视图中。请参阅统一审计和监控 Dashboard。
Amazon Bedrock 数据事件
默认情况下,CloudTrail 为您的账户记录管理事件,这已经捕获了常见的 Bedrock 运行时调用,如 InvokeModel、Converse 和 ConverseStream。许多关键的 AI 工作负载操作被记录为数据事件,包括 Agent 调用、知识库检索、Flow 执行、Guardrail 应用、双向流式传输、异步调用和 Prompt 渲染。这些操作需要在您的 trail 上配置高级事件选择器。数据事件为您的安全团队提供了对模型调用的可见性。请参阅下面的Bedrock 高级事件选择器了解要应用的具体选择器。
需要监控的关键 API
下表显示了哪些 Bedrock API 会被自动捕获,哪些需要在您的 trail 上配置高级事件选择器。
- Management Events (captured by default)
- Data Events (require advanced event selectors)
| API | Event Name | Why It Matters |
|---|---|---|
| InvokeModel | InvokeModel | Tracks which IAM identities are calling foundation models and when. |
| Streaming Invocation | InvokeModelWithResponseStream | Captures streaming model interactions for long-form generation tasks. |
| Conversational AI | Converse / ConverseStream | Records multi-turn conversational AI activity against foundation models. |
| Async Invocation Listing | ListAsyncInvokes | Monitors listing of asynchronous invocation jobs. |
数据事件需要配置高级事件选择器。
| API | Event Name | Resource Type | Why It Matters |
|---|---|---|---|
| Bidirectional Streaming | InvokeModelWithBidirectionalStream | AWS::Bedrock::Model | Captures bidirectional streaming model interactions. |
| Async Invocations | GetAsyncInvoke / StartAsyncInvoke | AWS::Bedrock::Model, AWS::Bedrock::AsyncInvoke | Monitors asynchronous model invocation jobs. Requires selectors for both resource types. |
| Agent Invocation | InvokeAgent | AWS::Bedrock::AgentAlias | Tracks invocations of deployed Bedrock agent aliases. |
| Inline Agent | InvokeInlineAgent | AWS::Bedrock::InlineAgent | Captures inline agent invocations. |
| RAG Activity | Retrieve / RetrieveAndGenerate | AWS::Bedrock::KnowledgeBase | Monitors Retrieval-Augmented Generation calls against Bedrock Knowledge Bases. |
| Flow Invocation | InvokeFlow | AWS::Bedrock::FlowAlias | Tracks invocations of Bedrock Prompt Flows. |
| Guardrail Application | ApplyGuardrail | AWS::Bedrock::Guardrail | Captures apply-guardrail operations. |
| Prompt Rendering | RenderPrompt | AWS::Bedrock::PromptVersion | Captures prompt rendering operations for prompts created using Prompt management. |
| Session Activity | Session API operations | AWS::Bedrock::Session | Captures session-level API activity for multi-turn Bedrock conversations. |
| Flow Execution | Flow execution API operations | AWS::Bedrock::FlowExecution | Captures Bedrock flow execution activity for monitoring prompt flow runs. |
| Automated Reasoning | Automated reasoning policy API operations | AWS::Bedrock::AutomatedReasoningPolicy | Captures activity on automated reasoning policies used for verifiable AI outputs. |
| Automated Reasoning Version | Automated reasoning policy version API operations | AWS::Bedrock::AutomatedReasoningPolicyVersion | Captures activity on specific versions of automated reasoning policies. |
| Data Automation Project | Data automation project API operations | AWS::Bedrock::DataAutomationProject | Captures Bedrock data automation project activity for document and media processing. |
| Data Automation Invocation | Data automation invocation API operations | AWS::Bedrock::DataAutomationInvocation | Captures Bedrock data automation invocation activity. |
| Data Automation Profile | Data automation profile API operations | AWS::Bedrock::DataAutomationProfile | Captures Bedrock data automation profile activity. |
| Blueprint | Blueprint API operations | AWS::Bedrock::Blueprint | Captures Bedrock blueprint activity for data automation configurations. |
| Advanced Prompt Optimization | Advanced optimize prompt job API operations | AWS::Bedrock::AdvancedOptimizePromptJob | Captures advanced prompt optimization job activity. |
| Tool Activity | Tool API operations | AWS::Bedrock::Tool | Captures Bedrock tool API activity for tool-use operations. |
由于 InvokeModel、Converse 和 ConverseStream 作为管理事件记录,它们在启用了管理事件日志的任何 trail 上都会被默认捕获。但是,Agent 调用、知识库检索、Flow 调用、Guardrail 应用、Prompt 渲染、异步调用、双向流式传输、会话活动、Flow 执行、自动推理、数据自动化、蓝图操作、高级 Prompt 优化和工具操作仅在您为 trail 上相应的 Bedrock 资源类型配置高级事件选择器时才会被记录。请参阅Bedrock 高级事件选择器了解配置方法,以及 Amazon Bedrock CloudTrail 文档了解支持的完整资源类型列表。
Bedrock 高级事件选择器
使用以下高级事件选择器在您的 CloudTrail trail 上捕获 Bedrock 数据事件。每个 Bedrock 资源类型需要自己的选择器,每个选择器应使用 resources.ARN 前缀将日志范围限定到您的特定资源。这配置了十八个独立的选择器 — 每种资源类型一个。大多数过滤器基于 eventCategory = Data 并使用范围限定到您账户的 resources.ARN 前缀。Model 和 AsyncInvoke 选择器改用 eventName 过滤,因为基础模型的 ARN 是 AWS 拥有的,不包含您的账户 ID。
以下选择器是示例。在不替换占位符的情况下应用它们将不会捕获任何事件。
| Placeholder | Replace With | Where to Find |
|---|---|---|
ACCOUNT_ID | Your 12-digit AWS account ID | AWS Console top-right menu |
REGION | Your AWS region (e.g., us-east-1) | Region selector in console |
AGENT_ID / ALIAS_ID | Agent and alias IDs | Bedrock console → Agents |
KB_ID | Knowledge Base ID | Bedrock console → Knowledge bases |
FLOW_ID | Flow ID | Bedrock console → Prompt flows |
GUARDRAIL_ID | Guardrail ID | Bedrock console → Guardrails |
PROMPT_ID | Prompt ID | Bedrock console → Prompt management |
POLICY_ID | Automated Reasoning Policy ID | Bedrock console → Automated reasoning |
PROJECT_ID | Data Automation Project ID | Bedrock console → Data automation |
TOOL_ID | Bedrock Tool ID | Bedrock console → Tools |
BEDROCK_EXECUTION_ROLE_NAME | IAM role name for Bedrock calls | IAM console → Roles |
YOUR_CLOUDTRAIL_LOG_GROUP | CloudWatch Logs log group for your CloudTrail trail | CloudTrail console → trail → CloudWatch Logs |
要记录给定类型的所有资源,请从 ARN 前缀中删除资源 ID(例如,agent-alias/AGENT_ID/ALIAS_ID → agent-alias/)— 这会增加事件量和成本。如果您使用 readOnly 或 eventName 过滤器,请验证它们是否与您需要的操作 匹配。
View all 18 Bedrock advanced event selectors (JSON)
[
{
"Name": "Bedrock-AgentAlias-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AgentAlias"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:agent-alias/AGENT_ID/ALIAS_ID"
]
}
]
},
{
"Name": "Bedrock-InlineAgent-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::InlineAgent"]
},
{
"Field": "eventName",
"Equals": ["InvokeInlineAgent"]
},
{
"Field": "userIdentity.arn",
"StartsWith": [
"arn:aws:sts::ACCOUNT_ID:assumed-role/BEDROCK_EXECUTION_ROLE_NAME"
]
}
]
},
{
"Name": "Bedrock-KnowledgeBase-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::KnowledgeBase"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:knowledge-base/KB_ID"
]
}
]
},
{
"Name": "Bedrock-FlowAlias-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::FlowAlias"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:flow/FLOW_ID/alias/"
]
}
]
},
{
"Name": "Bedrock-Guardrail-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::Guardrail"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:guardrail/GUARDRAIL_ID"
]
}
]
},
{
"Name": "Bedrock-Model-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::Model"]
},
{
"Field": "eventName",
"Equals": ["InvokeModelWithBidirectionalStream"]
}
]
},
{
"Name": "Bedrock-AsyncInvoke-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AsyncInvoke"]
},
{
"Field": "eventName",
"Equals": ["GetAsyncInvoke", "StartAsyncInvoke"]
}
]
},
{
"Name": "Bedrock-Prompt-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::PromptVersion"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:prompt/PROMPT_ID"
]
}
]
},
{
"Name": "Bedrock-Session-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::Session"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:session/"
]
},
{
"Field": "readOnly",
"Equals": ["false"]
}
]
},
{
"Name": "Bedrock-FlowExecution-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::FlowExecution"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:flow/FLOW_ID/alias/"
]
}
]
},
{
"Name": "Bedrock-AutomatedReasoningPolicy-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AutomatedReasoningPolicy"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:automated-reasoning-policy/POLICY_ID"
]
}
]
},
{
"Name": "Bedrock-AutomatedReasoningPolicyVersion-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AutomatedReasoningPolicyVersion"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:automated-reasoning-policy/POLICY_ID"
]
}
]
},
{
"Name": "Bedrock-DataAutomationProject-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::DataAutomationProject"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:data-automation-project/PROJECT_ID"
]
}
]
},
{
"Name": "Bedrock-DataAutomationInvocation-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::DataAutomationInvocation"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:data-automation-invocation/"
]
},
{
"Field": "readOnly",
"Equals": ["false"]
}
]
},
{
"Name": "Bedrock-DataAutomationProfile-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::DataAutomationProfile"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:data-automation-profile/"
]
},
{
"Field": "readOnly",
"Equals": ["false"]
}
]
},
{
"Name": "Bedrock-Blueprint-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::Blueprint"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:blueprint/"
]
},
{
"Field": "readOnly",
"Equals": ["false"]
}
]
},
{
"Name": "Bedrock-AdvancedOptimizePromptJob-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AdvancedOptimizePromptJob"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:advanced-optimize-prompt-job/"
]
},
{
"Field": "readOnly",
"Equals": ["false"]
}
]
},
{
"Name": "Bedrock-Tool-DataEvents",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::Tool"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:tool/TOOL_ID"
]
}
]
}
]
Bedrock 数据事件资源类型
CloudTrail 设计支持以下 Bedrock 资源类型的数据事件,为您的 AI 管道提供完整可见性:
Agent & Orchestration
| Resource Type | Key APIs | Description |
|---|---|---|
AWS::Bedrock::AgentAlias | InvokeAgent | Track invocations of deployed Bedrock agent aliases |
AWS::Bedrock::InlineAgent | InvokeInlineAgent | Capture inline agent invocations |
AWS::Bedrock::FlowAlias | InvokeFlow | Track Bedrock Prompt Flow invocations |
AWS::Bedrock::FlowExecution | Flow execution APIs | Capture flow execution activity for monitoring prompt flow runs |
AWS::Bedrock::Session | Session APIs | Capture session-level API activity for multi-turn conversations |
Selector notes for Agent & Orchestration resources
- FlowExecution — 将
resources.ARN缩小到特定的 Flow ID(例如,flow/FLOW_ID/alias/),因为 Flow 执行的 ARN 与 Flow 别名共享flow/前缀。 - Session — 使用
readOnly = false聚焦于写操作(会话创建和更新),减少高频读操作的数据量。
Model Invocation
| Resource Type | Key APIs | Description |
|---|---|---|
AWS::Bedrock::Model | InvokeModelWithBidirectionalStream | Log bidirectional streaming invocations |
AWS::Bedrock::AsyncInvoke | GetAsyncInvoke, StartAsyncInvoke | Log asynchronous invocation operations |
AWS::Bedrock::PromptVersion | RenderPrompt | Capture prompt rendering operations |
AWS::Bedrock::AdvancedOptimizePromptJob | Advanced optimize prompt APIs | Capture advanced prompt optimization job activity |
Selector notes for Model Invocation resources
- Model — 基础模型的 ARN 是 AWS 拥有的(例如,
arn:aws:bedrock:REGION::foundation-model/...),不包含您的账户 ID,因此此选择器使用eventName过滤而非resources.ARN。 - AsyncInvoke — 使用
eventName过滤来限定特定的异步操作。异步调用需要为AWS::Bedrock::Model和AWS::Bedrock::AsyncInvoke两者配置选择器。 - AdvancedOptimizePromptJob — 使用
readOnly = false聚焦于写操作(作业启动)。
Safety & Guardrails
| Resource Type | Key APIs | Description |
|---|---|---|
AWS::Bedrock::Guardrail | ApplyGuardrail | Capture apply-guardrail operations |
AWS::Bedrock::AutomatedReasoningPolicy | Automated reasoning APIs | Capture activity on automated reasoning policies for verifiable AI outputs |
AWS::Bedrock::AutomatedReasoningPolicyVersion | Automated reasoning version APIs | Capture activity on specific versions of automated reasoning policies |
Selector notes for Safety & Guardrails resources
- AutomatedReasoningPolicy — 缩小到特定的策略 ID,避免捕获账户中的所有策略。
- AutomatedReasoningPolicyVersion — 使用与策略选择器相同的策略 ID 前缀。
Knowledge & RAG
| Resource Type | Key APIs | Description |
|---|---|---|
AWS::Bedrock::KnowledgeBase | Retrieve, RetrieveAndGenerate | Monitor data source retrieval and ingestion activity |
AWS::Bedrock::Tool | Tool APIs | Capture tool API activity for tool-use operations |
Selector notes for Knowledge & RAG resources
- Tool — 缩小到特定的工具 ID,避免捕获账户中的所有工具活动。
Data Automation
| Resource Type | Key APIs | Description |
|---|---|---|
AWS::Bedrock::DataAutomationProject | Data automation project APIs | Capture project activity for document and media processing |
AWS::Bedrock::DataAutomationInvocation | Data automation invocation APIs | Capture data automation invocation activity |
AWS::Bedrock::DataAutomationProfile | Data automation profile APIs | Capture data automation profile activity |
AWS::Bedrock::Blueprint | Blueprint APIs | Capture blueprint activity for data automation configurations |
Selector notes for Data Automation resources
- DataAutomationProject — 缩小到特定的项目 ID。
- DataAutomationInvocation、DataAutomationProfile、Blueprint — 均使用
readOnly = false聚焦于写操作。
AWS::Bedrock::InlineAgent 选择器不包含 resources.ARN 过滤器,因为内联 Agent 没有持久的资源 ARN。为了减少数据量和成本,该选择器使用 eventName 过滤器(范围限定为 InvokeInlineAgent)和 userIdentity.arn 过滤器将日志范围限定到特定的 IAM 角色。请将 BEDROCK_EXECUTION_ROLE_NAME 替换为您的实际角色名称。如果您不使用内联 Agent,请完全删除此选择器。请参阅 Inline Agent: Filter by IAM Identity 了解完整的选择器 JSON。
在所有相关资源类型上配置上述高级事件选择器是本指南中启用 AI 工作负载可见性的关键第一步。不要在未指定高级事件选择器的情况下启用数据事件 — 未过滤的数据事件日志可能产生大量数据和高成本。有关最新支持的资源类型,请参阅 Amazon Bedrock data events in CloudTrail。
Amazon Bedrock AgentCore 数据事件
Amazon Bedrock AgentCore 提供用于运行、保护和连接 AI Agent 的托管基础设施 — 包括托管运行时、内置工具(代码解释器、浏览器)、身份和凭证管理、API 网关和持久内存。这些组件中的每一个都会生成数据面活动,CloudTrail 可以将其作为数据事件捕获,让您了解 Agent 如何执行代码、浏览网页、向第三方服务认证以及通过网关与用户交互。
AgentCore 数据事件提供对 Agent 行为的运行时可见性,包括代码执行、工具使用、内存操作 — 它们正在调用哪些工具、获取哪些凭证、哪些网关正在接收流量,或者是否有未识别的调用者正在访问您的 Agent 基础设施。
为什么 AgentCore 数据事件对 AI 安全至关重要
AgentCore 组件代表您 AI Agent 的操作面 — 即 Agent 采取实际行动的层。Bedrock 数据事件(上面已介绍)捕获的是 Agent 被要求做什么(调用模型、从知识库检索),而 AgentCore 数据事件捕获的是 Agent 实际做了什么。Agentic AI Security Scoping Matrix 为 Agent 系统定义了六个关键安全维度 — 以下要点将每个 AgentCore 功能映射到它所对应的矩阵维度:
- 代码执行 — Agent 通过 CodeInterpreter 运行用户提供的代码时可以访问文件、进行网络调用并产生副作用。监控这些调用可以检测到意外的代码运行或 Agent 在预期范围之外操作。(Agentic Matrix:Guardrails — 沙箱和隔离机制)
- 网页浏览 — 使用 Browser 工具的 Agent 会浏览外部网站,可能访问敏感 URL 或验证数据传输是否在预期范围内。记录浏览器活动为 Agent 访问的每个页面提供审计跟踪。(Agentic Matrix:Guardrails — 行为监控)
- 凭证访问 — Agent 使用存储在 TokenVault 中的 OAuth2 token、API 密钥和工作负载身份 token 向第三方 API 进行认证。意外的凭证访问模式可能表明异常的 Agent 活动或权限提升。(Agentic Matrix:Identity — 身份委托和凭证管理)
- 网关流量 — AgentCore Gateway 通过 MCP 协议和基于 JWT 的认证将 Agent 暴露给外部调用者。Gateway 数据事件捕获每个入站请求,包括认证失败 — 这对于检测来自 AWS 环境外部的意外访问尝试至关重要。(Agentic Matrix:Scope — 明确的操作边界)
- Agent 运行时活动 — Runtime 和 RuntimeEndpoint 事件跟踪 Agent 生命周期操作、会话管理和端点调用。此处的异常模式表明 Agent 在正常操作窗口之外被启动、停止或访问。(Agentic Matrix:Orchestration — Agent 到系统的交互管理)
- 内存操作 — 具有持久内存的 Agent 跨会话存储和检索对话上下文。意外的内存访问可能允许检索对话历史或修改 Agent 上下文。监控内存操作有助于验证访问是否在授权范围内。(Agentic Matrix:Data — 持久内存和状态安全)
- Agent 评估 — Evaluator 事件跟踪对 Agent 输出的自动化质量和安全评估。监控这些事件有助于验证您的评估管道是否保持按预期配置。(Agentic Matrix:Audit & Logging — 操作级别的 Agent 行为跟踪)
AgentCore 数据事件资源类型
CloudTrail 支持 以下 AgentCore 资源类型的数据事件:
- Built-in Tools
- Identity & Credentials
- Runtime & Gateway
- Memory & Evaluation
| Resource Type | resources.type | Security Relevance |
|---|---|---|
| Code Interpreter | AWS::BedrockAgentCore::CodeInterpreter | Detect unintended code runs, sandbox boundary issues |
| Code Interpreter (Custom) | AWS::BedrockAgentCore::CodeInterpreterCustom | Detect unauthorized custom code runs |
| Browser | AWS::BedrockAgentCore::Browser | Audit agent web navigation, detect unintended data transfer via URLs |
| Browser (Custom) | AWS::BedrockAgentCore::BrowserCustom | Audit custom browser tool usage |
| Resource Type | resources.type | Security Relevance |
|---|---|---|
| Workload Identity | AWS::BedrockAgentCore::WorkloadIdentity | Detect unauthorized identity token requests |
| Workload Identity Directory | AWS::BedrockAgentCore::WorkloadIdentityDirectory | Monitor identity directory enumeration or modification |
| Token Vault | AWS::BedrockAgentCore::TokenVault | Detect unauthorized credential access or data transfer |
| OAuth2 Credential Provider | AWS::BedrockAgentCore::OAuth2CredentialProvider | Monitor OAuth2 token retrieval for unauthorized access |
| API Key Credential Provider | AWS::BedrockAgentCore::APIKeyCredentialProvider | Monitor API key retrieval patterns for anomalies |
| Resource Type | resources.type | Security Relevance |
|---|---|---|
| Runtime | AWS::BedrockAgentCore::Runtime | Detect unauthorized agent starts, stops, or configuration changes |
| Runtime Endpoint | AWS::BedrockAgentCore::RuntimeEndpoint | Monitor agent endpoint access patterns |
| Gateway | AWS::BedrockAgentCore::Gateway | Detect unauthorized external access, authentication failures |
| Resource Type | resources.type | Security Relevance |
|---|---|---|
| Memory | AWS::BedrockAgentCore::Memory | Detect unauthorized memory reads or context modification |
| Evaluator | AWS::BedrockAgentCore::Evaluator | Monitor evaluation pipeline integrity |
AgentCore 高级事件选择器
使用以下高级事件选择器在您的 CloudTrail trail 上捕获 AgentCore 数据事件。这些选择器按安全功能分为四组:内置工具、身份和凭证、运行时和网关、以及内存和评估。每个选择器使 用 resources.ARN 前缀来限定日志范围。对于 AWS 托管的内置工具(CodeInterpreter 和 Browser),省略了 resources.ARN 过滤器,因为它们使用 AWS 拥有的 ARN — 仅 resources.type 过滤器就足够了。
以下选择器是示例。在不替换占位符的情况下应用它们将不会捕获任何事件。 Replace ACCOUNT_ID and REGION with your values (see the Bedrock placeholder table above). AgentCore-specific placeholders are listed below.
| Placeholder | Replace With | Where to Find |
|---|---|---|
GATEWAY_ID | AgentCore Gateway ID | AgentCore console or ListGateways API |
RUNTIME_ID | AgentCore Runtime ID | ListRuntimes API |
DIRECTORY_ID | Workload Identity Directory ID | AgentCore console |
PROVIDER_NAME | OAuth2 or APIKey credential provider name | AgentCore console |
MEMORY_ID | AgentCore Memory ID | AgentCore console |
EVALUATOR_ID | AgentCore Evaluator ID | AgentCore console |
CUSTOM_TOOL_ID / CUSTOM_BROWSER_ID | Custom tool or browser configuration IDs | AgentCore console |
要记录给定类型的所有资源,请从 ARN 前缀中删除资源 ID(例如,gateway/GATEWAY_ID → gateway/)— 这会增加事件量和成本。
- Group 1: Built-in Tools
- Group 2: Identity & Credentials
- Group 3: Runtime & Gateway
- Group 4: Memory & Evaluation
这些选择器捕获 Agent 工具使用情况 — Agent 在现实世界中采取的行动。代码解释器事件揭示 Agent 执行了什么代码;浏览器事件揭示 Agent 访问了哪些网站。(实现 Agentic AI Security Scoping Matrix 的 Guardrails 维度 — Agent 操作的沙箱、隔离机制和行为监控。)
AWS 托管的内置工具(CodeInterpreter 和 Browser)使用账户段设置为 aws 的 AWS 拥有的资源 ARN(例如,arn:aws:bedrock-agentcore:REGION:aws:code-interpreter/),而不是您的账户 ID。自定义工具(CodeInterpreterCustom 和 BrowserCustom)使用您的账户 ID。以下选择器反映了这种区别。如果您只使用托管工具,可以省略自定义工具选择器。
[
{
"Name": "AgentCore-CodeInterpreter-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::CodeInterpreter"] }
]
},
{
"Name": "AgentCore-CodeInterpreterCustom-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::CodeInterpreterCustom"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:code-interpreter-custom/CUSTOM_TOOL_ID"] }
]
},
{
"Name": "AgentCore-Browser-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Browser"] }
]
},
{
"Name": "AgentCore-BrowserCustom-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::BrowserCustom"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:browser-custom/CUSTOM_BROWSER_ID"] }
]
}
]
这些选择器捕获 Agent 如何向第三方服务认证和管理凭证。意外的凭证访问模式可能表明未授权的 Agent 访问。(实现 Agentic AI Security Scoping Matrix 的 Identity 维度 — 身份委托、凭证管理和避免混淆代理问题。)
[
{
"Name": "AgentCore-WorkloadIdentity-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::WorkloadIdentity"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:workload-identity-directory/DIRECTORY_ID"] }
]
},
{
"Name": "AgentCore-WorkloadIdentityDirectory-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::WorkloadIdentityDirectory"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:workload-identity-directory/DIRECTORY_ID"] }
]
},
{
"Name": "AgentCore-TokenVault-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::TokenVault"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:token-vault/default"] }
]
},
{
"Name": "AgentCore-APIKeyCredentialProvider-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::APIKeyCredentialProvider"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:token-vault/default/apikeycredentialprovider/PROVIDER_NAME"] }
]
},
{
"Name": "AgentCore-OAuth2CredentialProvider-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::OAuth2CredentialProvider"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:token-vault/default/oauth2credentialprovider/PROVIDER_NAME"] }
]
}
]
这些选择器捕获 Agent 生命周期和外部访问模式。Runtime 事件显示 Agent 何时启动、停止和处理请求。Gateway 事件捕获每个入站 MCP 请求,包括 JWT 认证失败。(实现 Agentic AI Security Scoping Matrix 的 Orchestration 维度 — Agent 到系统的交互管理、执行流控制,以及 Scope 维度 — 明确的操作边界。)
AgentCore Gateway 数据事件使用基于 JWT 的认证而非 SigV4。这意味着身份信息被捕获在 additionalEventData.jwt.claims 字段中,而不是标准的 userIdentity 字段中。错误信息出现在 responseElements 中,而不是顶级的 errorCode 和 errorMessage 字段中。您的 Gateway 事件查询和 metric 过滤器必须考虑这种差异。请参阅 Gateway 数据事件查询了解示例。
[
{
"Name": "AgentCore-Runtime-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Runtime"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:runtime/RUNTIME_ID"] }
]
},
{
"Name": "AgentCore-RuntimeEndpoint-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::RuntimeEndpoint"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:runtime/RUNTIME_ID"] }
]
},
{
"Name": "AgentCore-Gateway-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Gateway"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:gateway/GATEWAY_ID"] }
]
}
]
这些选择器捕获 Agent 内存操作和评估活动。内存事件揭示 Agent 何时存储或检索对话上下文。Evaluator 事件跟踪自动化质量评估。(实现 Agentic AI Security Scoping Matrix 的 Data 维度 — 具有内存完整性验证的持久内存和状态安全。)
[
{
"Name": "AgentCore-Memory-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Memory"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:memory/MEMORY_ID"] }
]
},
{
"Name": "AgentCore-Evaluator-DataEvents",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Evaluator"] },
{ "Field": "resources.ARN", "StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:evaluator/EVALUATOR_ID"] }
]
}
]
AgentCore 数据事件可能产生大量数据,尤其是 Gateway(每个入站 MCP 请求)和 Runtime(每个 Agent 会话操作)。
Recommended rollout order:
- 从第 2 组(凭证)和第 3 组(网关)开始 — 这些通常是最高安全优先级。
- 在建立基线数据量和成本后扩展到第 1 组和第 4 组。
按资源 ID 缩小选择器范围: 使用特定的 resources.ARN 值来针对单个资源 — 例如,arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:gateway/PROD_GATEWAY_ID 用于单个网关。对于 AWS 托管的内置工具(CodeInterpreter 和 Browser),省略了 resources.ARN 过滤器,因为它们使用 AWS 拥有的 ARN — 仅 resources.type 过滤器就足够了。
CloudTrail Insights 事件
CloudTrail Insights 旨在通过持续分析您账户的运营基线来识别异常 API 活动。对于 AI 工作负载,合法使用本身可能涉及大量调用,Insights 提供了一种检测偏离既定基线的异常激增的方法 — 即使绝对调用量在单独来看时似乎合理。
Insight 类型
| Insight Type | Detection Purpose |
|---|---|
| ApiCallRateInsight | Detects spikes in API call volume that deviate from the baseline. |
| ApiErrorRateInsight | Detects unusual error rate patterns. A sudden increase in AccessDenied or ThrottlingException errors can indicate repeated access attempts to credentials, repeated unintended access attempts, or an automated agent hitting rate limits. |
配置指导
在 CloudTrail 控制台中导航到您的 trail,选择 Edit,并在 Insights 部分下启用两种 Insights 事件类型,即可在 CloudTrail trail 上启用 Insights。
对于 trail,您可以为管理事件和数据事件都启用 Insights。选择事件类型(管理事件、数据事件或两者)然后选择 Insights 类型(API 调用率、API 错误率或两者)。您的 trail 必须正在记录 Write 管理或数据事件才能启用 API call rate Insights,必须正在记录 Read 或 Write 管理或数据 事件才能启用 API error rate Insights。
CloudTrail Insights 事件被传送到与标准事件相同的 Amazon S3 存储桶和 CloudWatch Logs log group,位于 Insights 前缀下。您可以直接在 Insights 事件上创建 metric 过滤器和告警,以在检测到异常活动时触发自动响应。CloudTrail 在启用后可能需要最多 36 小时才能开始传送 Insights 事件(前提是在此期间检测到异常活动)。
CloudTrail 管理事件
CloudTrail 管理事件旨在记录 AWS 环境中的控制面操作:创建和删除资源、修改配置以及更改权限。对于 AI 工作负载安全,这些事件可以浮现需要审查的意外访问模式 — 如禁用日志记录、重定向审计跟踪或削弱 AI 服务的 Guardrail。
验证读取和写入管理事件在所有区域都已启用日志记录。默认的 CloudTrail trail 为每个区域提供一份免费的管理事件副本;额外副本会产生费用。详情请参阅 CloudTrail 定价。
AI 安全的关键管理事件
- Bedrock Configuration
- Bedrock Invocation
- AgentCore
- Audit Trail & IAM
| Event Name | Why It Matters |
|---|---|
UpdateAccountSettings | Detects changes to account-level Bedrock configurations. |
PutModelInvocationLoggingConfiguration | Detects configuration changes with Bedrock invocation logging settings. |
DeleteModelInvocationLoggingConfiguration | Detects removal of Bedrock logging configuration entirely. |
CreateGuardrail / UpdateGuardrail / DeleteGuardrail | Detects changes to Bedrock content filtering and safety controls. |
| Event Name | Why It Matters |
|---|---|
InvokeModel / InvokeModelWithResponseStream | Logged as management events by default — tracks which IAM identities are calling foundation models. |
Converse / ConverseStream | Logged as management events by default — records multi-turn conversational AI activity. |
ListAsyncInvokes | Logged as a management event by default — monitors listing of asynchronous invocation jobs. |
| Event Name | Why It Matters |
|---|---|
CreateGateway / UpdateGateway / DeleteGateway | Detects creation, modification, or deletion of AgentCore Gateways that expose agents to external callers. |
CreateGatewayTarget / UpdateGatewayTarget / DeleteGatewayTarget | Detects changes to gateway routing targets — an unintended redirection of agent traffic to an unintended endpoint. |
| Event Name | Service | Why It Matters |
|---|---|---|
DeleteTrail / StopLogging | CloudTrail | Detects attempts to disable the audit trail entirely. |
PutBucketPolicy / DeleteBucketPolicy | S3 | Detects bucket policy changes on log destination buckets. |
AttachRolePolicy / DetachRolePolicy / PutRolePolicy | IAM | Detects IAM permission escalation that could expand AI workload access. |
一种常见的意外访问模式涉及在进行进一步活动之前更改日志配置,例如禁用 trail 或将 log 重定向到外部控制的存储桶。建议监控 StopLogging、DeleteTrail 和 PutModelInvocationLoggingConfiguration 以保护审计跟踪的完整性。
Amazon S3 和 Lambda 数据事件
AI 工作负载频繁与 Amazon S3 存储桶(用于训练数据、模型制品和 CI/CD 管道资产)和 Lambda 函数(用于 AI 推理、数据预处理和 Agent 编排)交互。在数据事件级别监控这些资源类型,可以让您了解管理事件无法捕获的对象级别和函数调用级别的活动。
Amazon S3 目标存储桶和事件类型
为包含以下内容的存储桶启用 Amazon S3 数据事件:
- AI 训练数据集和微调数据
- 模型制品和配置文件
- CI/CD 管道制品和代码仓库
需要监控的关键 Amazon S3 操作:
- PutObject — 检测未授权的写入访问或为未授权数据访问进行的数据暂存
- GetObject — 检测训练数据或模型制品的批量下载
- DeleteObject — 检测数据删除或日志修改活动
- CopyObject — 检测跨存储桶的意外数据移动