AWS पर AI वर्कलोड की मॉनिटरिंग और ऑडिटिंग
परिचय
AWS पर आधुनिक AI वर्कलोड तीन स्वतंत्र पाइपलाइनों में टेलीमेट्री जनरेट करते हैं — CloudTrail (किसने क्या कॉल किया), Bedrock Model Invocation Logging (मॉडल ने क्या कहा), और ADOT SDK द्वारा एकत्रित Agent Telemetry (एजेंट ने कैसा प्रदर्शन किया)। प्रत्येक पाइपलाइन आवश्यक है। CloudTrail अकेले आपको बता सकता है कि एक IAM role ने InvokeModel कॉल किया, लेकिन यह नहीं कि उस role ने मॉडल से क्या पूछा या एजेंट ने कैसे प्रतिक्रिया दी। Model Invocation Logging सामग्री कैप्चर करता है लेकिन agent orchestration नहीं। ADOT orchestration कैप्चर करता है लेकिन inference parameters या IAM identity नहीं। सुरक्षा और परिचालन जांच में लगभग हमेशा कम से कम दो को correlate करने की आवश्यकता होती है।
यह गाइड आपको दिखाती है कि AI वर्कलोड के लिए एक पूर्ण मॉनिटरिंग और ऑडिटिंग कहानी कैसे बनाएं:
- तीनों टेलीमेट्री पाइपलाइनों को सक्षम करना — इस गाइड में संक्षिप्त सेटअप के साथ companion guides के deep links।
- CloudTrail पर detection rules बनाना — Bedrock और AgentCore data events दोनों को कवर करते हुए metric filters, alarms और Contributor Insights rules।
- Cross-pipeline correlation queries चलाना — CloudTrail को Bedrock Model Invocation Logging और ADOT spans के साथ join करना ताकि उन सवालों का जवाब दिया जा सके जो कोई एकल पाइपलाइन अकेले नहीं दे सकती।
The Generative AI Security Scoping Matrix and the Agentic AI Security Scoping Matrix define the security dimensions organizations need to address when building AI applications, including audit and logging, identity context, agency perimeters, and data protection. This guide provides the concrete implementation for those dimensions using CloudTrail, CloudWatch, and cross-pipeline correlation. The tabs below map each matrix dimension to the guide sections that implement it.
- 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 is responsible for the security of the cloud infrastructure running CloudTrail, CloudWatch, and Bedrock services. Customers are responsible for security in the cloud, including configuring event selectors, creating detection rules, setting alarm thresholds, and responding to security events. This guide focuses on customer configuration and monitoring responsibilities for AI workloads. For more information, see the AWS Shared Responsibility Model.
तीन संयुक्त चुनौतियां
मात्रा — AI model invocations उच्च event volumes जनरेट कर सकते हैं। सटीक event selectors और aggregation के बिना, रुचि के events को उच्च मात्रा में अलग करना कठिन है और सब कुछ कैप्चर करने की लागत निषेधात्मक है।
गति — Agent-initiated activity sequences में सेकंड के भीतर कई API calls, tool invocations और model interactions शामिल हो सकते हैं। Near-real-time detection rules परिचालन विसंगतियों को तेजी से सामने लाने में मदद करते हैं।
जटिलता — AI वर्कलोड गतिविधि कई AWS सेवाओं में फैली होती है। कोई एकल log source पूर्ण दृश्यता प्रदान नहीं करता। Cross-pipeline correlation वह जगह है जहां जांच वास्तव में होती है।
यह गाइड क्या कवर करती है
- तीन टेलीमेट्री पाइपलाइन और प्रत्येक क ्या uniquely कैप्चर करती है
- तीनों के लिए enablement (CloudTrail विस्तार से; अन्य दो संक्षिप्त चरणों + deep links के साथ)
- CloudTrail-specific detection: Bedrock और AgentCore data events दोनों के लिए metric filters, alarms, Contributor Insights
- AgentCore data events: gateway traffic, built-in tool usage, credential access, memory operations, और runtime activity
- जांच के लिए cross-pipeline correlation queries
- तीनों data sources को मिलाने वाला एक unified dashboard
GenAI टेलीमेट्री परिदृश्य: तीन पूरक पाइपलाइन
CloudTrail is one of three telemetry pipelines that together provide full observability for AI workloads on AWS. Each captures different data, serves different purposes, and is enabled differently. Security investigations almost always require correlating at least two.

| 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 observability |
What Each Pipeline Answers on Its Own
CloudTrail alone tells you:
- Which IAM identity called
InvokeModel? - What was the source IP, user agent, and region?
- Was the call denied (AccessDenied, UnauthorizedOperation)?
- Did someone modify a guardrail, stop logging, or escalate IAM permissions?
- Which VPC endpoint blocked the call?
Model Invocation Logging alone tells you:
- What prompt was sent to the model?
- What did the model return?
- What temperature and max_tokens were used?
- How many input and output tokens did the call consume?
- Was the response truncated (stop_reason = max_tokens)?
Agent Telemetry (ADOT SDK) alone tells you:
- How long did the model call take (client-side latency)?
- Which tools did the agent call, in what order?
- Did a tool fail, and which component caused the error?
- How is the agent session chained across multiple model calls?
Where Correlation Unlocks Investigation
Questions only correlation can answer
| 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 |
The Cross-Pipeline Correlation Queries section gives you the actual JOIN queries for these scenarios. :::
कार्यान्वयन अवलोकन
एक चरणबद्ध रोलआउट जो तीनों पाइपलाइनों को सक्षम करता है, फिर detection और correlation को ऊपर लेयर करता है।
Phase 1: Enable Observability Pipelines
Start with the two observability pipelines (Bedrock Model Invocation Logging and Agent Telemetry collected by the ADOT SDK). They're quick to enable and they're what makes the correlation queries possible. CloudTrail setup follows in Phase 2.
Pipeline A: Bedrock Model Invocation Logging
Captures full prompt, response, inference parameters, and caller IAM identity for every Bedrock model call. Manual opt-in only. (Implements the Generative AI Security Scoping Matrix Governance & Compliance dimension by capturing model interactions to support data sovereignty requirements and compliance audit workflows.)
- Open the Amazon Bedrock console
- Choose Settings → Model invocation logging
- Enable logging and choose CloudWatch Logs (and/or S3) as the destination
- Configure the log group name (default:
bedrock-model-invocation-logging) and service role
For detailed configuration, PII masking, and dashboard setup, see GenAI Observability on AWS.
Pipeline B: Agent Telemetry (collected by ADOT SDK)
Captures agent orchestration, distributed traces, and tool execution.
- AgentCore: No action required because the ADOT SDK is included in the runtime by default, and telemetry flows automatically to
aws/spansand/aws/bedrock-agentcore/runtimes/<agent> - EKS/ECS/self-hosted: Attach the ADOT auto-instrumentation agent to your workload. No code changes needed
Enable CloudWatch Transaction Search to unlock the full Application Signals experience.
For detailed enablement steps, see GenAI Observability on AWS — Enabling Observability for Agentic Workloads and the AgentCore Observability Quickstart.
Phase 2: Enable CloudTrail — Start with Bedrock, Expand Coverage, Ingest to CloudWatch
Configure CloudTrail to capture the full AI workload audit surface, starting with the highest-value resource (Bedrock) and expanding outward. Deliver everything to CloudWatch Logs so it can be joined with Pipelines A and B.
Step 1: Bedrock and AgentCore data events and management events
Enable Bedrock Data Events on your trail using advanced event selectors. These operations are not logged by default. See Amazon Bedrock Data Events.
| 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 |
Enable AgentCore Data Events using advanced event selectors. See Amazon Bedrock AgentCore Data Events.
| 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 |
Plus any remaining AgentCore resource types as they become available.
Verify Management Events (Read and Write) are enabled in all regions — this captures InvokeModel and Converse as management events automatically, and AgentCore management events like CreateGateway, CreateGatewayTarget, etc. See CloudTrail Management Events.
Enable CloudTrail Insights (ApiCallRateInsight and ApiErrorRateInsight) for anomaly detection. See CloudTrail Insights Events.
Step 2: Expand to S3, Lambda, and network activity
- Enable Amazon S3 Data Events (write-only) for training data, model artifacts, and CI/CD pipeline buckets. See Amazon S3 and Lambda Data Events.
- Enable Lambda Data Events for production AI pipeline functions, excluding dev/test. See Amazon S3 and Lambda Data Events.
- Enable Network Activity Events for Bedrock, S3, and Lambda VPC endpoints, targeting
VpceAccessDenied. See CloudTrail Network Activity Events.
Step 3: Deliver to CloudWatch Logs
- Configure your CloudTrail trail to deliver to a CloudWatch Logs log group.
Phase 3: Build Detection Rules on CloudTrail
- Create metric filters for CloudTrail events (unauthorized Bedrock access, guardrail changes, logging disruption). See Metric Filters.
- Create CloudWatch Alarms on each metric filter with SNS notification targets. See CloudWatch Alarms.
- Create Contributor Insights rules to identify top IAM identities and source IPs. See Contributor Insights Rules.
Phase 4: Build Cross-Pipeline Correlation Queries
- Develop CloudWatch Logs Insights queries for standard CloudTrail detection. See Security Analytics.
- Build cross-pipeline JOIN queries that combine CloudTrail with Bedrock Model Invocation Logging and ADOT spans. See Cross-Pipeline Correlation Queries.
- Save validated queries for recurring use by security and operations analysts.
Phase 5: Optimize with Event Aggregation
- Enable CloudTrail Event Aggregation (
API_ACTIVITY,RESOURCE_ACCESS,USER_ACTIONStemplates) for 5-minute summaries alongside raw data events. See CloudTrail Data Event Aggregation. - Use CloudWatch Subscription Filters to forward only management and aggregated events to downstream SIEM, reducing ingestion volume.
Phase 6: Assemble the Unified Dashboard
- Build a CloudWatch Dashboard combining CloudTrail alarms, Contributor Insights widgets, Model Invocation Log cost widgets, ADOT performance widgets, and correlation query results into a single pane. See Unified Audit & Monitoring Dashboard.
Amazon Bedrock Data Events
By default, CloudTrail logs management events for your account, which already captures common Bedrock runtime calls like InvokeModel, Converse, and ConverseStream. Many key AI workload operations are logged as data events, including agent invocations, knowledge base retrievals, flow executions, guardrail applications, bidirectional streaming, async invocations, and prompt rendering. These operations require advanced event selectors on your trail. Data events provide your security team with visibility into model invocations. See Advanced Event Selectors for Bedrock below for the specific selectors to apply.
Key APIs to Monitor
The table below shows which Bedrock APIs are captured automatically and which require advanced event selector configuration on your 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. |
Data events require advanced event selectors to be configured.
| 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. |
Because InvokeModel, Converse, and ConverseStream are logged as management events, they are captured by default on any trail with management event logging enabled. However, agent invocations, knowledge base retrievals, flow invocations, guardrail applications, prompt rendering, async invocations, bidirectional streaming, session activity, flow executions, automated reasoning, data automation, blueprint operations, advanced prompt optimization, and tool operations are only logged when you configure advanced event selectors for the corresponding Bedrock resource types on your trail. See Advanced Event Selectors for Bedrock for the configuration, and the Amazon Bedrock CloudTrail documentation for the full list of supported resource types.
Advanced Event Selectors for Bedrock
Use the following advanced event selectors to capture Bedrock data events on your CloudTrail trail. Each Bedrock resource type requires its own selector, and each selector should scope logging to your specific resources using resources.ARN prefixes. This configures eighteen separate selectors — one per resource type. Most filter on eventCategory = Data with a resources.ARN prefix scoped to your account. The Model and AsyncInvoke selectors use eventName filtering instead because foundation model ARNs are AWS-owned and don't contain your account ID.
The selectors below are examples. Applying them without replacing placeholders will capture no events.
| 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 |
To log all resources of a given type, remove the resource ID from the ARN prefix (e.g., agent-alias/AGENT_ID/ALIAS_ID → agent-alias/) — this increases event volume and cost. If you use readOnly or eventName filters, verify they match the operations you need.
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 Data Event Resource Types
CloudTrail is designed to support data events for the following Bedrock resource types, providing full visibility into your AI pipeline:
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 — Narrow
resources.ARNto a specific flow ID (e.g.,flow/FLOW_ID/alias/) since flow execution ARNs share theflow/prefix with flow aliases. - Session — Uses
readOnly = falseto focus on write operations (session creation and updates) and reduce volume from high-frequency read operations.
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 — Foundation model ARNs are AWS-owned (e.g.,
arn:aws:bedrock:REGION::foundation-model/...) and do not contain your account ID, so this selector useseventNamefiltering instead ofresources.ARN. - AsyncInvoke — Uses
eventNamefiltering to scope to specific async operations. Async invocations require selectors for bothAWS::Bedrock::ModelandAWS::Bedrock::AsyncInvoke. - AdvancedOptimizePromptJob — Uses
readOnly = falseto focus on write operations (job starts).
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 — Narrow to a specific policy ID to avoid capturing all policies in the account.
- AutomatedReasoningPolicyVersion — Uses the same policy ID prefix as the policy selector.
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 — Narrow to a specific tool ID to avoid capturing all tool activity in the account.
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 — Narrow to a specific project ID.
- DataAutomationInvocation, DataAutomationProfile, Blueprint — All use
readOnly = falseto focus on write operations.
The AWS::Bedrock::InlineAgent selector does not include a resources.ARN filter because inline agents don't have persistent resource ARNs. To reduce volume and cost, the selector uses an eventName filter (scoped to InvokeInlineAgent) and a userIdentity.arn filter to scope logging to specific IAM roles. Replace BEDROCK_EXECUTION_ROLE_NAME with your actual role name. If you don't use inline agents, remove this selector entirely. See Inline Agent: Filter by IAM Identity for the complete selector JSON.
Configuring the advanced event selectors above across all relevant resource types is the critical first step for enabling AI workload visibility in this guide. Do not enable data events without specifying advanced event selectors — unfiltered data event logging can generate high volume and cost. For the latest supported resource types, see Amazon Bedrock data events in CloudTrail.
Amazon Bedrock AgentCore Data Events
Amazon Bedrock AgentCore provides managed infrastructure for running, securing, and connecting AI agents — including hosted runtimes, built-in tools (code interpreters, browsers), identity and credential management, API gateways, and persistent memory. Each of these components generates data-plane activity that CloudTrail can capture as data events, giving you visibility into how your agents execute code, browse the web, authenticate to third-party services, and interact with users through gateways.
AgentCore data events provide runtime visibility into agent behavior, including code runs, tool usage, memory operations — which tools they're invoking, which credentials they're fetching, which gateways are receiving traffic, or whether unrecognized callers are accessing your agent infrastructure.
Why AgentCore Data Events Matter for AI Security
AgentCore components represent the operational surface of your AI agents — the layer where agents take real-world actions. While Bedrock data events (covered above) capture what the agent is asked to do (invoke a model, retrieve from a knowledge base), AgentCore data events capture what the agent actually does. The Agentic AI Security Scoping Matrix defines six critical security dimensions for agentic systems — the bullets below map each AgentCore capability to the matrix dimension it addresses:
- Code runs — Agents running user-provided code through CodeInterpreter can access files, make network calls, and produce side effects. Monitoring these invocations detects unintended code runs or agents operating outside their intended scope. (Agentic Matrix: Guardrails — sandboxing and isolation mechanisms)
- Web browsing — Agents using the Browser tool navigate external websites, potentially accessing sensitive URLs or verify data transfer stays within intended boundaries. Logging browser activity provides an audit trail of every page an agent visits. (Agentic Matrix: Guardrails — behavioral monitoring)
- Credential access — Agents authenticate to third-party APIs using OAuth2 tokens, API keys, and workload identity tokens stored in TokenVault. Unexpected credential access patterns may indicate anomalous agent activity or permission escalation. (Agentic Matrix: Identity — identity delegation and credential management)
- Gateway traffic — AgentCore Gateways expose agents to external callers via MCP protocol with JWT-based authentication. Gateway data events capture every inbound request, including authentication failures — key for detecting unintended access attempts from outside your AWS environment. (Agentic Matrix: Scope — clear operational boundaries)
- Agent runtime activity — Runtime and RuntimeEndpoint events track agent lifecycle operations, session management, and endpoint invocations. Anomalous patterns here indicate agents being started, stopped, or accessed outside normal operational windows. (Agentic Matrix: Orchestration — agent-to-system interaction management)
- Memory operations — Agents with persistent memory store and retrieve conversation context across sessions. Unintended memory access may allow retrieval of conversation history or modification of agent context. Monitoring memory operations helps verify access stays within authorized scope. (Agentic Matrix: Data — persistent memory and state security)
- Agent evaluation — Evaluator events track automated quality and safety assessments of agent outputs. Monitoring these helps verify your evaluation pipeline remains configured as intended. (Agentic Matrix: Audit & Logging — action-level agent action tracking)
AgentCore Data Event Resource Types
CloudTrail supports data events for the following AgentCore resource types:
- 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 |
Advanced Event Selectors for AgentCore
Use the following advanced event selectors to capture AgentCore data events on your CloudTrail trail. These selectors are organized into four groups based on security function: built-in tools, identity and credentials, runtime and gateway, and memory and evaluation. Each selector scopes logging using resources.ARN prefixes. For AWS-managed built-in tools (CodeInterpreter and Browser), the resources.ARN filter is omitted because these use AWS-owned ARNs — the resources.type filter alone is sufficient.
The selectors below are examples. Applying them without replacing placeholders will capture no events. 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 |
To log all resources of a given type, remove the resource ID from the ARN prefix (e.g., gateway/GATEWAY_ID → gateway/) — this increases event volume and cost.
- Group 1: Built-in Tools
- Group 2: Identity & Credentials
- Group 3: Runtime & Gateway
- Group 4: Memory & Evaluation
These selectors capture agent tool usage — the actions agents take in the real world. Code interpreter events reveal what code agents execute; browser events reveal what websites agents visit. (Implements the Agentic AI Security Scoping Matrix Guardrails dimension — sandboxing, isolation mechanisms, and behavioral monitoring for agent actions.)
AWS-managed built-in tools (CodeInterpreter and Browser) use AWS-owned resource ARNs with the account segment set to aws (e.g., arn:aws:bedrock-agentcore:REGION:aws:code-interpreter/), not your account ID. Custom tools (CodeInterpreterCustom and BrowserCustom) use your account ID. The selectors below reflect this distinction. If you only use the managed tools, you can omit the custom tool selectors.
[
{
"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"] }
]
}
]
These selectors capture how agents authenticate to third-party services and manage credentials. Unexpected credential access patterns may indicate unauthorized agent access. (Implements the Agentic AI Security Scoping Matrix Identity dimension — identity delegation, credential management, and avoiding the Confused Deputy Problem.)
[
{
"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"] }
]
}
]
These selectors capture agent lifecycle and external access patterns. Runtime events show when agents start, stop, and process requests. Gateway events capture every inbound MCP request, including JWT authentication failures. (Implements the Agentic AI Security Scoping Matrix Orchestration dimension — agent-to-system interaction management, execution flow control, and the Scope dimension — clear operational boundaries.)
AgentCore Gateway data events use JWT-based authentication rather than SigV4. This means identity information is captured in the additionalEventData.jwt.claims field rather than the standard userIdentity fields. Error information appears in responseElements rather than top-level errorCode and errorMessage fields. Your queries and metric filters for Gateway events must account for this difference. See Gateway Data Event Queries for examples.
[
{
"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"] }
]
}
]
These selectors capture agent memory operations and evaluation activity. Memory events reveal when agents store or retrieve conversation context. Evaluator events track automated quality assessments. (Implements the Agentic AI Security Scoping Matrix Data dimension — persistent memory and state security with memory integrity verification.)
[
{
"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 data events can generate significant volume, especially for Gateway (every inbound MCP request) and Runtime (every agent session operation).
Recommended rollout order:
- Start with Group 2 (credentials) and Group 3 (gateway) — these are typically the highest security priority.
- Expand to Groups 1 and 4 after establishing baseline volume and cost.
Narrowing selectors by resource ID: Use specific resources.ARN values to target individual resources — for example, arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:gateway/PROD_GATEWAY_ID for a single gateway. For managed built-in tools (CodeInterpreter and Browser), the resources.ARN filter is omitted because these use AWS-owned ARNs — the resources.type filter alone is sufficient.
CloudTrail Insights Events
CloudTrail Insights is designed to identify unusual API activity by continuously analyzing your account's operational baseline. For AI workloads, where legitimate usage can itself involve high call volumes, Insights provides a way to detect anomalous spikes that deviate from the established norm — even when the absolute call volume appears reasonable in isolation.
Insight Types
| 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. |
Configuration Guidance
Enable Insights on your CloudTrail trail by navigating to the trail in the CloudTrail console, selecting Edit, and enabling both Insights event types under the Insights section.
For trails, you can enable Insights for both management events and data events. Select the event type (management events, data events, or both) and then choose the Insights types (API call rate, API error rate, or both). Your trail must be logging Write management or data events to enable API call rate Insights, and must be logging Read or Write management or data events to enable API error rate Insights.
CloudTrail Insights events are delivered to the same Amazon S3 bucket and CloudWatch Logs log group as your standard events, under an Insights prefix. You can create metric filters and alarms directly on Insights events to trigger automated responses when anomalous activity is detected. CloudTrail may take up to 36 hours to begin delivering Insights events after enablement, provided unusual activity is detected during that time.
CloudTrail Management Events
CloudTrail Management events are designed to record control-plane operations in your AWS environment: creating and deleting resources, modifying configurations, and changing permissions. For AI workload security, these events surface unexpected access patterns for review — disabling logging, redirecting audit trails, or weakening AI service guardrails.
Verify that both Read and Write management events are logged on all regions. The default CloudTrail trail provides one free copy of management events per region; additional copies incur charges. See CloudTrail pricing for details.
Key Management Events for AI Security
- 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. |
A common unintended access pattern involves changes to logging configurations, such as disabling trails or redirecting logs to an externally controlled bucket, before conducting further activity. Monitoring for StopLogging, DeleteTrail, and PutModelInvocationLoggingConfiguration is recommended to protect the integrity of your audit trail.
Amazon S3 and Lambda Data Events
AI workloads frequently interact with Amazon S3 buckets (for training data, model artifacts, and CI/CD pipeline assets) and Lambda functions (for AI inference, data preprocessing, and agent orchestration). Monitoring these resource types at the data event level gives you visibility into the object-level and function-invocation-level activity that management events do not capture.
Amazon S3 Target Buckets and Event Types
Enable Amazon S3 data events for buckets containing:
- AI training datasets and fine-tuning data
- Model artifacts and configuration files
- CI/CD pipeline artifacts and code repositories
Key Amazon S3 operations to monitor:
- PutObject — Detects unauthorized write access or data staging for unauthorized data access
- GetObject — Detects bulk downloads of training data or model artifacts
- DeleteObject — Detects data deletion or log modification activity
- CopyObject — Detects unintended data movement across buckets
Amazon S3 Write-Only Selector
The following selector reduces Amazon S3 data event volume by logging only write operations on specifically named AI-related buckets:
The bucket name prefixes below (ai-training-data-, model-artifacts-, cicd-pipeline-) are examples. Replace them with the actual names or naming prefixes of your S3 buckets that contain AI training data, model artifacts, and pipeline assets. You can find your bucket names in the S3 console or by running aws s3 ls. If your buckets use a different naming convention, adjust the StartsWith values accordingly.
Filters Amazon S3 data events to capture only write operations (readOnly = false) on buckets whose names start with ai-training-data-, model-artifacts-, or cicd-pipeline-. This avoids logging high-volume read operations (like GetObject) while still detecting unauthorized writes, deletions, and data staging.
[
{
"Name": "S3-AI-Sensitive-WriteOnly",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::S3::Object"]
},
{
"Field": "readOnly",
"Equals": ["false"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:s3:::ai-training-data-",
"arn:aws:s3:::model-artifacts-",
"arn:aws:s3:::cicd-pipeline-"
]
}
]
}
]
Lambda AI Pipeline Functions
Enable Lambda data events to log InvokeFunction calls for:
- AI inference pipeline functions
- Data preprocessing and feature engineering workflows
- Bedrock agent orchestration functions
An unexpected spike in Lambda invocations, especially from an unfamiliar IAM role, is an early indicator that an unintended access to your Lambda-based AI pipeline functions.
Lambda Production-Only Selector
This selector excludes development and test functions to focus logging on production AI workloads:
The function name prefixes below (prod-, ai-agent-) are examples. Replace them with the actual naming prefixes your organization uses for production AI Lambda functions. Also replace ACCOUNT_ID with your AWS account ID and REGION with your region. You can find your function names in the Lambda console or by running aws lambda list-functions.
Logs Lambda Invoke data events only for functions whose ARN starts with prod- or ai-agent-. Because StartsWith already scopes to these specific prefixes, development and test functions are excluded by definition — CloudTrail does not allow two field selectors on the same field (resources.ARN) within a single selector, even with different operators. Replace ACCOUNT_ID and region with your values.
[
{
"Name": "Lambda-AI-Production-Invocations",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Lambda::Function"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:lambda:REGION:ACCOUNT_ID:function:prod-",
"arn:aws:lambda:REGION:ACCOUNT_ID:function:ai-agent-"
]
}
]
}
]
CloudTrail Network Activity Events
CloudTrail Network Activity Events are designed to enable VPC endpoint owners to record AWS API calls made through VPC endpoints from a private VPC to AWS services. For AI workloads, this provides visibility into whether your Bedrock-integrated VPCs are making unexpected outbound calls or whether VPC endpoint access controls are being violated. (Implements the Agentic AI Security Scoping Matrix Scope dimension — enforcing clear operational boundaries and detecting agents operating outside their intended network perimeter.)
AI Workload VPC Endpoints
CloudTrail Network activity events support Amazon Bedrock (bedrock.amazonaws.com), Amazon S3 (s3.amazonaws.com), and AWS Lambda (lambda.amazonaws.com) as event sources. Enable these events on your VPC endpoints to capture API calls routed through each endpoint, including both permitted and denied access attempts. For AI workloads, this is particularly important because Bedrock agents operating within a VPC access downstream services — Amazon S3 for knowledge base data sources, Lambda for action group handlers — through VPC endpoints. Denied access at the VPC endpoint level indicates either a misconfigured endpoint policy or an unauthorized workload attempting to reach AI resources from within your private network.
Additional event sources to consider enabling:
| Event Source | Monitoring Purpose |
|---|---|
| bedrock.amazonaws.com | Monitor AI model access and detect unauthorized invocations through VPC endpoints. |
| s3.amazonaws.com | Detect unauthorized Amazon S3 access to training data buckets through VPC endpoints. |
| kms.amazonaws.com | Monitor encryption key access patterns for AI model encryption operations. |
| lambda.amazonaws.com | Track Lambda invocations through VPC endpoints from AI pipeline functions. |
| sagemaker.amazonaws.com | Track SageMaker endpoint activity in AI workload environments. |
Advanced event selector fields for network activity events
For initial deployment, focus on capturing VpceAccessDenied errors across all AI-relevant VPC endpoints to detect violations of your VPC endpoint policies with minimal additional data volume. The selectors below cover Bedrock, Amazon S3, and Lambda — the three services most commonly accessed by AI agents through VPC endpoints.
Logs network activity events where Bedrock, Amazon S3, or Lambda returned a VpceAccessDenied error, indicating traffic from within your VPC was blocked by a VPC endpoint policy. This captures denied access across the full AI workload surface without the volume of logging all successful network activity. Amazon S3 denials detect agents blocked from reaching training data or model artifact buckets. Lambda denials detect agents blocked from invoking action group handlers or AI pipeline functions.
View Network Activity VpceAccessDenied selectors (JSON)
[
{
"Name": "Bedrock-NetworkActivity-VpceAccessDenied",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["NetworkActivity"]
},
{
"Field": "eventSource",
"Equals": ["bedrock.amazonaws.com"]
},
{
"Field": "errorCode",
"Equals": ["VpceAccessDenied"]
}
]
},
{
"Name": "S3-NetworkActivity-VpceAccessDenied",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["NetworkActivity"]
},
{
"Field": "eventSource",
"Equals": ["s3.amazonaws.com"]
},
{
"Field": "errorCode",
"Equals": ["VpceAccessDenied"]
}
]
},
{
"Name": "Lambda-NetworkActivity-VpceAccessDenied",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["NetworkActivity"]
},
{
"Field": "eventSource",
"Equals": ["lambda.amazonaws.com"]
},
{
"Field": "errorCode",
"Equals": ["VpceAccessDenied"]
}
]
}
]
Implementation Priority Checklist
The following table presents the recommended implementation order for enabling CloudTrail event types in your AI workload environment. Each step builds on the previous, starting with the high-impact changes and progressing to more targeted monitoring configurations.
| Step | Event Type | What to Enable | Details |
|---|---|---|---|
| 1 | Management Events | All services, all regions (Read + Write) | Captures InvokeModel, Converse, ListAsyncInvokes, and AgentCore management events by default |
| 2 | Data Events | All 18 Bedrock resource types | Agent invocations, RAG, flows, guardrails, sessions, data automation, tools, and more. See Bedrock selectors |
| 3 | Data Events | All 14 AgentCore resource types | Gateway traffic, runtime operations, built-in tools, credentials, memory, evaluation. See AgentCore selectors |
| 4 | Insights Events | Account-wide | ApiCallRateInsight and ApiErrorRateInsight for management and data events |
| 5 | Data Events | AWS::S3::Object (AI buckets) | Write-only on ai-training-data, model-artifacts, and cicd-pipeline prefixed buckets |
| 6 | Data Events | AWS::Lambda::Function | Production AI functions only; exclude dev and test function name prefixes |
| 7 | Network Activity Events | Bedrock, S3, and Lambda VPC endpoints | VpceAccessDenied on bedrock.amazonaws.com, s3.amazonaws.com, and lambda.amazonaws.com |
Optimizing Data Event Collection
Advanced event selectors enable precise filtering to control both costs and log volume. The following strategies show how to narrow each major resource type to only the events of security interest.
Bedrock: Narrow to Production Resources
The advanced event selectors above already scope Bedrock data events to specific resources by ARN. To further reduce volume, narrow the ARN prefixes to only production agents and knowledge bases, excluding non-production or experimental resources:
The resource IDs below (PROD_AGENT_ID, PROD_KB_ID) are examples. Replace them with the actual agent and knowledge base IDs from your production environment. You can find these IDs in the Bedrock console under Agents and Knowledge bases, or by running aws bedrock list-agents and aws bedrock list-knowledge-bases.
Restricts Bedrock data event logging to only agent aliases and knowledge bases whose ARNs match specific resource ID prefixes. Use this when you have identified the exact agent and knowledge base IDs used in production and want to exclude all others. Replace ACCOUNT_ID and the resource IDs with your values.
[
{
"Name": "Bedrock-Production-Agents-Only",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::AgentAlias"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:agent-alias/PROD_AGENT_ID"
]
}
]
},
{
"Name": "Bedrock-Production-KnowledgeBases-Only",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::KnowledgeBase"]
},
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:bedrock:REGION:ACCOUNT_ID:knowledge-base/PROD_KB_ID"
]
}
]
}
]
Amazon S3: Write-Only on AI Buckets
Reduce Amazon S3 data event volume by logging only write operations on AI-specific buckets. Read operations can be added later for high-value buckets if unauthorized data transfer detection is prioritized.
Refer to Section 6.2 for the complete Amazon S3 write-only advanced event selector JSON.
Inline Agent: Filter by IAM Identity
The AWS::Bedrock::InlineAgent selector does not support resources.ARN filtering because inline agents do not have persistent resource ARNs. Without additional filtering, this selector captures all InvokeInlineAgent calls across the account, which can generate high data event volume and cost. Use the userIdentity.arn field to scope logging to specific IAM roles — for example, your production Bedrock execution roles — while excluding development or automated service roles that generate high-volume inline agent calls.
The role names below (BEDROCK_EXECUTION_ROLE_NAME, dev-, test-) are examples. Replace ACCOUNT_ID with your AWS account ID and BEDROCK_EXECUTION_ROLE_NAME with the actual name of the IAM role your application uses to call InvokeInlineAgent. You can find your role names in the IAM console under Roles, or check the execution role configured on your Bedrock agents. In the "Exclude Dev Roles" tab, replace dev- and test- with the actual naming prefixes your organization uses for non-production roles.
Restricts InlineAgent data event logging to only invocations made by IAM roles matching a specific ARN prefix. The eventName filter restricts capture to only InvokeInlineAgent calls are captured, and the userIdentity.arn filter scopes to your production roles. Replace ACCOUNT_ID with your AWS account ID and BEDROCK_EXECUTION_ROLE_NAME with the actual name of the IAM role your application uses to call InvokeInlineAgent.
- Include Production Roles
- Exclude Dev Roles
[
{
"Name": "Bedrock-InlineAgent-ProductionRolesOnly",
"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-InlineAgent-ExcludeDevRoles",
"FieldSelectors": [
{
"Field": "eventCategory",
"Equals": ["Data"]
},
{
"Field": "resources.type",
"Equals": ["AWS::Bedrock::InlineAgent"]
},
{
"Field": "eventName",
"Equals": ["InvokeInlineAgent"]
},
{
"Field": "userIdentity.arn",
"NotStartsWith": [
"arn:aws:sts::ACCOUNT_ID:assumed-role/dev-",
"arn:aws:sts::ACCOUNT_ID:assumed-role/test-"
]
}
]
}
]
The userIdentity.arn field is supported on all advanced event selectors, not just InlineAgent. You can apply the same filtering technique to any high-volume data event selector where resources.ARN filtering is insufficient. For the full list of supported fields and operators, see Filtering data events by using advanced event selectors.
Lambda: Production Functions Only
Focus data event logging on production AI workloads by scoping the StartsWith operator to only production function prefixes (prod-, ai-agent-). Development and test functions are excluded by definition because their prefixes do not match.
Refer to Section 6.4 for the complete Lambda production-only advanced event selector JSON.
CloudTrail Network Activity Events: VpceAccessDenied Only
For network activity events, logging only denied access across Bedrock, Amazon S3, and Lambda VPC endpoints captures the key security events while reducing the volume compared to logging all network activity.
Refer to Advanced event selector fields for network activity events for the complete Bedrock, Amazon S3, and Lambda VpceAccessDenied network activity event selector JSON.
AgentCore: Phased Enablement by Security Priority
AgentCore data events span fourteen resource types. Enable them in phases based on security priority:
- Phase 1 (Highest priority): Gateway (
AWS::BedrockAgentCore::Gateway) and credential access (TokenVault,OAuth2CredentialProvider,APIKeyCredentialProvider) — these capture external access and credential retrieval, the two most security-sensitive surfaces. - Phase 2: Runtime and RuntimeEndpoint — captures agent lifecycle and session management.
- Phase 3: Built-in tools (
CodeInterpreter,Browserand their Custom variants) — captures agent actions in the real world. - Phase 4: Memory, WorkloadIdentity, WorkloadIdentityDirectory, and Evaluator — captures agent state and identity management.
To narrow Gateway data events to specific gateways, replace the broad gateway/ prefix with the specific gateway ID:
{
"Field": "resources.ARN",
"StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:gateway/PROD_GATEWAY_ID"]
}
Similarly, to narrow Runtime data events to a specific agent runtime:
{
"Field": "resources.ARN",
"StartsWith": ["arn:aws:bedrock-agentcore:REGION:ACCOUNT_ID:runtime/PROD_RUNTIME_ID"]
}
CloudTrail Advanced Event Selectors for Organization Level Trail
For an AWS Organizations trail covering multiple accounts, combine all AI workload selectors into a single trail configuration. This defines a complete set of advanced event selectors combining Bedrock data events, AgentCore data events, S3 write-only filtering, Lambda production function logging, and Bedrock network activity denied-access detection — all in one trail.
The selectors below are examples that combine all service selectors into a single organization trail. Every placeholder must be replaced with your actual resource identifiers before applying.
See the Bedrock and AgentCore sections above for the full placeholder reference tables. For organization trails spanning multiple accounts, you may need to duplicate selectors with different ACCOUNT_ID values or use broader ARN prefixes scoped to each member account.
View complete Organization Trail selectors (34 selectors — JSON)
[
{
"Name": "OrgTrail-Bedrock-AgentInvocations",
"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/"] }
]
},
{
"Name": "OrgTrail-Bedrock-InlineAgent",
"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": "OrgTrail-Bedrock-KnowledgeBase",
"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": "OrgTrail-Bedrock-FlowAlias",
"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": "OrgTrail-Bedrock-Guardrail",
"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": "OrgTrail-Bedrock-Model",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::Bedrock::Model"] },
{ "Field": "eventName", "Equals": ["InvokeModelWithBidirectionalStream"] }
]
},
{
"Name": "OrgTrail-Bedrock-AsyncInvoke",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::Bedrock::AsyncInvoke"] },
{ "Field": "eventName", "Equals": ["GetAsyncInvoke", "StartAsyncInvoke"] }
]
},
{
"Name": "OrgTrail-Bedrock-Prompt",
"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": "OrgTrail-Bedrock-Session",
"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": "OrgTrail-Bedrock-FlowExecution",
"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": "OrgTrail-Bedrock-AutomatedReasoningPolicy",
"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": "OrgTrail-Bedrock-AutomatedReasoningPolicyVersion",
"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": "OrgTrail-Bedrock-DataAutomationProject",
"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": "OrgTrail-Bedrock-DataAutomationInvocation",
"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": "OrgTrail-Bedrock-DataAutomationProfile",
"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": "OrgTrail-Bedrock-Blueprint",
"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": "OrgTrail-Bedrock-AdvancedOptimizePromptJob",
"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": "OrgTrail-Bedrock-Tool",
"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"] }
]
},
{
"Name": "OrgTrail-AgentCore-Gateway",
"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"] }
]
},
{
"Name": "OrgTrail-AgentCore-Runtime",
"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": "OrgTrail-AgentCore-RuntimeEndpoint",
"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": "OrgTrail-AgentCore-CodeInterpreter",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::CodeInterpreter"] }
]
},
{
"Name": "OrgTrail-AgentCore-Browser",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::BedrockAgentCore::Browser"] }
]
},
{
"Name": "OrgTrail-AgentCore-WorkloadIdentity",
"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": "OrgTrail-AgentCore-TokenVault",
"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": "OrgTrail-AgentCore-OAuth2CredentialProvider",
"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"] }
]
},
{
"Name": "OrgTrail-AgentCore-APIKeyCredentialProvider",
"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": "OrgTrail-AgentCore-Memory",
"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": "OrgTrail-AgentCore-Evaluator",
"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"] }
]
},
{
"Name": "OrgTrail-S3-AI-WriteOnly",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::S3::Object"] },
{ "Field": "readOnly", "Equals": ["false"] },
{
"Field": "resources.ARN",
"StartsWith": [
"arn:aws:s3:::ai-",
"arn:aws:s3:::model-",
"arn:aws:s3:::training-"
]
}
]
},
{
"Name": "OrgTrail-Lambda-ProdAI",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["Data"] },
{ "Field": "resources.type", "Equals": ["AWS::Lambda::Function"] },
{
"Field": "resources.ARN",
"StartsWith": ["arn:aws:lambda:REGION:ACCOUNT_ID:function:prod-"]
}
]
},
{
"Name": "OrgTrail-Network-BedrockDenied",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["NetworkActivity"] },
{ "Field": "eventSource", "Equals": ["bedrock.amazonaws.com"] },
{ "Field": "errorCode", "Equals": ["VpceAccessDenied"] }
]
},
{
"Name": "OrgTrail-Network-S3Denied",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["NetworkActivity"] },
{ "Field": "eventSource", "Equals": ["s3.amazonaws.com"] },
{ "Field": "errorCode", "Equals": ["VpceAccessDenied"] }
]
},
{
"Name": "OrgTrail-Network-LambdaDenied",
"FieldSelectors": [
{ "Field": "eventCategory", "Equals": ["NetworkActivity"] },
{ "Field": "eventSource", "Equals": ["lambda.amazonaws.com"] },
{ "Field": "errorCode", "Equals": ["VpceAccessDenied"] }
]
}
]
Security Analytics for Your AI Workloads
The previous sections configured what CloudTrail captures — event selectors, resource types, and delivery to CloudWatch Logs. This section shifts from enablement to detection: the queries below surface the security signals buried in those events, from unintended access attempts and guardrail modification to agent credential access and gateway authentication failures.
CloudWatch Logs Insights supports OpenSearch SQL syntax, enabling complex JOINs across log groups, sub-queries for cross-service correlation, and a rich set of SQL functions for time-based and aggregation analysis. All queries below are specifically scoped to the AI workload use case. The queries cover management events, data events (agent invocations, knowledge base retrievals, flow invocations, AgentCore gateway traffic, built-in tool usage, credential access, memory operations), network activity events (VPC endpoint denials), and cross-service correlation for agent-to-resource access patterns.
All queries use YOUR_CLOUDTRAIL_LOG_GROUP as a placeholder. Replace it with the name of the CloudWatch Logs log group where your CloudTrail trail delivers events (e.g., aws-cloudtrail-logs/management-events). You can find this in the CloudTrail console under your trail's CloudWatch Logs configuration. Cross-pipeline queries also reference bedrock-model-invocation-logging and aws/spans — replace those if your log groups use different names.
When using OpenSearch SQL syntax in CloudWatch Logs Insights, enclose fields with special characters in backticks. For example: `userIdentity.arn`, `responseElements.ConsoleLogin`. Set the query language to SQL when creating these query widgets in your dashboard.
- Access & Identity
- Configuration Changes
- Network & VPC
- AgentCore
Query 1: Detect Unauthorized Bedrock Access (Management and Data Events)
Surfaces all IAM identities receiving AccessDenied or UnauthorizedOperation errors against Bedrock APIs
Surfaces all IAM identities receiving AccessDenied or UnauthorizedOperation errors against Bedrock APIs across both management events (model invocations) and data events (agent, knowledge base, flow, guardrail operations), ranked by frequency. A high count from an unfamiliar identity is an indicator of unintended access attempts.
GROUP BY `userIdentity.arn`, eventName, errorCode, errorMessage, sourceIPAddress
ORDER BY attempt_count DESC
Query 2: Monitor Bedrock Agent Invocations by IAM Identity
Tracks which IAM identities are triggering Bedrock agent and inline agent invocations
Tracks which IAM identities are triggering Bedrock agent and inline agent invocations. Agents chain multiple downstream API calls per invocation — an unfamiliar identity or volume spike here has a high scope of access. This query targets data events captured by the AWS::Bedrock::AgentAlias and AWS::Bedrock::InlineAgent advanced event selectors.
SELECT `userIdentity.arn` AS iam_identity,
eventName,
sourceIPAddress,
awsRegion,
COUNT(*) AS agent_invocation_count
FROM `YOUR_CLOUDTRAIL_LOG_GROUP`
WHERE eventSource = 'bedrock.amazonaws.com'
AND eventName IN ('InvokeAgent', 'InvokeInlineAgent')
GROUP BY `userIdentity.arn`, eventName, sourceIPAddress, awsRegion
ORDER BY agent_invocation_count DESC