Amazon Bedrock model invocation logging is the only native record of what was actually sent to and returned by a model, and it is turned off until you configure it. CloudTrail tells you who called InvokeModel or Converse and when; invocation logging adds the request and response bodies, token counts and caller identity. That makes it valuable for investigation and cost attribution, and also makes the log destination one of the most sensitive data stores in the account, because it holds every prompt and output. This guide covers what the logs capture, how to set up CloudWatch Logs and S3 destinations, how to protect and retain the logged content, detection use cases, and how invocation logs fit alongside CloudTrail. It is for cloud security engineers and AI platform teams.
This is an independent guide from NHI Mgmt Group, based on AWS's public documentation as of November 2026. It is not sponsored or reviewed by AWS. Product features change, so confirm settings against AWS's current documentation.
Key takeaways
- Turn it on per Region. Model invocation logging is disabled by default and is configured per account and Region, with destinations in the same account and Region.
- Know what is covered. AWS documents logging for
Converse,ConverseStream,InvokeModelandInvokeModelWithResponseStreamon thebedrock-runtimeendpoint. - Treat the destination as sensitive data. Log bodies contain prompts and outputs, so apply KMS encryption, tight access, CloudWatch Logs data protection policies and a retention period that matches your privacy notice.
- Use S3 for completeness. Bodies up to 100 KB are logged inline; larger JSON bodies and binary data go only to S3 as separate objects.
- Pair it with CloudTrail and metrics. CloudTrail records the API calls and configuration changes, the
AWS/Bedrockmetrics show volume and errors, and invocation logs supply content and per-principal token use.
What invocation logging captures
When enabled, Bedrock writes one JSON entry per supported invocation with the same structure for both destinations. The AWS documentation lists these fields:
| Field | Content | Security use |
|---|---|---|
schemaType, schemaVersion | Always ModelInvocationLog, plus version | Parser routing |
timestamp | Invocation time (ISO 8601) | Timeline building |
accountId, region | Calling account and Region | Spotting use in unexpected Regions |
requestId | Unique request identifier | Join to CloudTrail and application logs |
operation | For example Converse or InvokeModel | Baseline of call types per workload |
modelId | Model ID or inference profile ID | Unapproved model detection |
identity.arn | IAM or STS ARN of the caller, captured automatically | Attribution to the workload identity |
requestMetadata | Optional caller-supplied key-value tags | Team, application or environment attribution |
input.inputBodyJson, input.inputTokenCount | Request body (up to 100 KB inline) and token count | Prompt content review, injection investigation, cost |
output.outputBodyJson, output.outputTokenCount | Response body (up to 100 KB inline) and token count | Data leakage review, cost |
In the console you choose which data types to log: text, image, embedding and video, in any combination. AWS states that data is logged for every model supporting the selected modality as input, output or both. Once enabled, logs are kept until the logging configuration is deleted; retention in the destination is your decision.
Scope limits to plan for
- Endpoint: AWS states logging applies to calls through the
bedrock-runtimeendpoint, including the OpenAI-compatible Responses and Chat Completions APIs on that endpoint, and that calls through other endpoints such asbedrock-mantleare outside its current scope. Inventory which endpoints your applications use and check the logging options for each. - Region: each Region needs its own configuration. A workload that switches Regions, or an attacker using stolen keys in an unused Region, is only logged where you configured it.
- Large payloads: JSON bodies over 100 KB and binary data are uploaded as separate S3 objects under the data prefix, and the log entry references their location. With CloudWatch Logs only, you get the inline portion.
- Agents and knowledge bases: higher-level operations such as
InvokeAgentandRetrieveAndGenerateare CloudTrail data events; see the Amazon Bedrock Agents Security Guide and the Amazon Bedrock Knowledge Bases Security Guide.
Setting up destinations (CloudWatch Logs and S3)
You must create the destination first, then enable logging in the console or with PutModelInvocationLoggingConfiguration. GetModelInvocationLoggingConfiguration and DeleteModelInvocationLoggingConfiguration read and remove it.
| Choice | Strengths | Constraints | Fits |
|---|---|---|---|
| CloudWatch Logs only | Logs Insights queries, metric filters, subscription filters, data protection masking | Inline bodies only (100 KB); no large or binary payloads | Text-only workloads needing fast detection |
| S3 only | Complete payloads, lifecycle rules, low storage cost, Object Lock option | Querying needs Athena or a SIEM pipeline | Archive and investigation, multimodal workloads |
| Both | Fast queries plus complete content; CloudWatch entries reference S3 objects | Two stores to secure and retain | Most production estates |
Implementation steps
- Create the KMS keys (symmetric customer managed keys) for the S3 bucket and the log group, with key policies described in the next section.
- Create the S3 bucket with ACLs disabled (AWS requires this so the bucket policy takes effect), Block Public Access on and SSE-KMS default encryption.
- Add the bucket policy allowing
bedrock.amazonaws.coms3:PutObjecton<prefix>/AWSLogs/<account>/BedrockModelInvocationLogs/*, conditioned onaws:SourceAccountandaws:SourceArn(arn:aws:bedrock:<region>:<account>:*). The console attaches it automatically if you holds3:GetBucketPolicyands3:PutBucketPolicy; review it either way. - Create the log group with
aws logs create-log-group --kms-key-id, and set a retention period on it. - Create the IAM role for CloudWatch delivery: trust policy for
bedrock.amazonaws.comsts:AssumeRolewith the sameaws:SourceAccountandaws:SourceArnconditions; permissions limited tologs:CreateLogStreamandlogs:PutLogEventson theaws/bedrock/modelinvocationslog stream ARN. - Enable logging in a non-production account first, select data types, run test invocations and confirm entries arrive in both destinations.
- Alarm on delivery: Bedrock emits
ModelInvocationLogsCloudWatchDeliveryFailure,ModelInvocationLogsS3DeliveryFailureandModelInvocationLargeDataS3DeliveryFailureinAWS/Bedrock. Alarm on any non-zero value. - Roll out by Region and account using infrastructure as code, so every Region where Bedrock is allowed has the same configuration.
- Roll back with
DeleteModelInvocationLoggingConfigurationif delivery breaks a workload's compliance position; existing log data stays in the destinations.
The aws:SourceAccount and aws:SourceArn conditions are the confused-deputy protection: they stop Bedrock acting on behalf of another account to write into your bucket or assume your role. Do not remove them.
Protecting logged prompts and outputs
Prompts routinely contain customer data, pasted documents, source code and sometimes secrets. Treat the log stores with the same controls as the data the application processes, and assume that read access to the logs equals read access to that data.
- KMS for S3: where the bucket uses SSE-KMS, AWS requires a key policy statement allowing
bedrock.amazonaws.comkms:GenerateDataKey, conditioned onaws:SourceAccountandaws:SourceArn. - KMS for CloudWatch Logs: the key policy must allow
logs.<region>.amazonaws.comwith thekms:EncryptionContext:aws:logs:arncondition; useArnEqualsto bind the key to the one log group. Only symmetric keys are supported. AWS warns that if the key is disabled or CloudWatch Logs loses access, the encrypted data can no longer be read. - Masking in CloudWatch Logs: a data protection policy on the log group audits and masks managed data identifiers (credentials such as AWS secret access keys and private keys, card numbers, national identifiers, health identifiers, IP addresses) at ingestion. Only principals with
logs:Unmasksee original values. Masking applies only to events ingested after the policy is set, and theLogEventsWithFindingsmetric shows how often sensitive data appears. - Separate readers from writers: application roles that call Bedrock need no read access to the logs. Grant read to a small investigation role, require MFA or a break-glass process for
logs:Unmaskand S3GetObjecton the data prefix. - Central logging account: destinations must be in the same account and Region as the configuration, so replicate S3 objects or forward CloudWatch data to a central security account with its own keys, rather than giving many people access in workload accounts.
- Request metadata hygiene: AWS's Bedrock data protection guidance says not to put confidential or sensitive information in tags or free-form fields. Apply the same rule to
requestMetadata: use team and application identifiers, not user emails or customer IDs.
Logging machine identities deserves attention too: identity.arn is only useful if each workload has its own role. Shared roles or long-lived access keys make attribution impossible. See the Amazon Bedrock Security Guide for identity and access design.
Retention and privacy
Bedrock keeps writing logs until you delete the configuration, and deleting log data is up to you. Set retention deliberately.
| Store | Retention control | Suggested approach |
|---|---|---|
| CloudWatch Logs group | Log group retention setting | Short (for example 30 to 90 days) for hot detection, matched to your privacy notice |
| S3 invocation logs | Lifecycle expiration, storage class transitions | Longer only where an investigation or legal need is documented |
| S3 large data prefix | Separate lifecycle rule on the data prefix | Same or shorter than the log entries that reference it |
| Central security copy | Lifecycle in the security account, optional Object Lock | Integrity for audit; check Object Lock does not block erasure obligations |
- Privacy notice and lawful basis: if prompts contain personal data, logging them is processing. State it, set the retention and record the purpose (security monitoring, abuse investigation).
- Erasure requests: immutable or long-retained logs can conflict with deletion rights. Decide in advance how a request covering prompt logs is handled; see the Right to Erasure Engineering Guide.
- Data minimisation: select only the data types you need. If a workload processes images you never investigate, consider whether image logging is necessary, and document the decision.
- Sensitive workloads: for highly sensitive prompts, some teams log only metadata via CloudTrail and metrics; this loses content for investigations, so record the trade-off.
The Secure AI logging guide covers these trade-offs across platforms.
Detection use cases
Invocation logs, CloudTrail and AWS/Bedrock metrics together support the following detections. Example query logic is described; adapt it to your SIEM.
| Detection | Data | Logic | Threat mapping |
|---|---|---|---|
| Token volume spike | InputTokenCount, OutputTokenCount, Invocations metrics; per-principal sums of token counts in logs | Anomaly band or threshold per ModelId and per identity.arn | ATT&CK T1496.004 Cloud Service Hijacking; OWASP LLM10:2025 Unbounded Consumption |
| New principal using models | identity.arn | Principal not seen in the last 30 days, or a human user ARN where only workload roles are expected | ATT&CK T1078.004 Cloud Accounts; ATLAS AML.T0040 AI Model Inference API Access |
| Unapproved model or Region | modelId, region | Not on the approved model list or outside allowed Regions | Policy violation, possible credential misuse |
| Sensitive data in prompts or outputs | LogEventsWithFindings metric, masking audit findings | Findings above baseline for a workload | OWASP LLM02:2025 Sensitive Information Disclosure |
| Prompt injection investigation | inputBodyJson, outputBodyJson | Retrospective search for known injection strings after an alert | OWASP LLM01:2025 Prompt Injection |
| Throttling and error bursts | InvocationThrottles, InvocationClientErrors | Burst from one principal suggests automated abuse or probing | T1496.004 |
| Logging tampering | CloudTrail | Calls to DeleteModelInvocationLoggingConfiguration or PutModelInvocationLoggingConfiguration; delivery failure metrics | NIST SP 800-53 AU-9 |
AWS notes that if a request fails before Bedrock determines the model, its metrics are published without ModelId, so filtering by model can undercount errors; query errors without a dimension as well. AWS's documentation also gives a CloudWatch Logs Insights pattern that groups input.inputTokenCount and output.outputTokenCount by identity.arn, which is the basis of per-principal usage and cost alerts. For stolen-credential model abuse response, see the LLMjacking Response Playbook.
Metrics that show the logging is working
- Coverage: share of Regions where Bedrock is permitted that have logging configured (target 100%).
- Delivery health: count of delivery failure metric data points (target 0).
- Attribution: share of invocations whose
identity.arnmaps to a named workload role (target 100%). - Exposure: number of principals with read or
logs:Unmaskaccess to invocation logs (keep it small and reviewed). - Retention conformity: log groups and buckets whose retention matches the documented policy.
Relationship with CloudTrail
| Aspect | CloudTrail | Model invocation logging |
|---|---|---|
| Default state | Management events recorded by default; data events need advanced event selectors and are charged | Disabled by default |
InvokeModel, Converse and streaming variants | Management events | Logged with bodies when enabled |
InvokeAgent, Retrieve, RetrieveAndGenerate, InvokeFlow, ApplyGuardrail | Data events (resource types such as AWS::Bedrock::AgentAlias, AWS::Bedrock::KnowledgeBase, AWS::Bedrock::Guardrail) | Use CloudTrail data events and the service-specific logs for these |
| Prompt and response content | Metadata such as modelId, per AWS examples; use invocation logging for content | Recorded (inline up to 100 KB, larger in S3) |
| Caller identity | userIdentity | identity.arn |
| Token counts | Stream-completion service events carry inputTokens and outputTokens | inputTokenCount, outputTokenCount |
| Best for | Audit of who did what, configuration changes | Content investigation, per-principal usage |
AWS notes that streaming operations also produce an AwsServiceEvent after the stream ends, which is not an API call and is not evaluated by IAM or SCPs. Filter on eventType = AwsApiCall when counting invocations or analysing denied requests, and join the service event to its call using serviceEventDetails.parentRequestId.
Decision guidance
- Small teams with one account and one Region: enable both destinations, a KMS-encrypted log group with 30 to 90 day retention, a data protection policy and alarms on token spikes and delivery failure.
- Large estates with AWS Organizations: deploy the configuration to every account and allowed Region through infrastructure as code, centralise copies in a security account, deny Bedrock in unapproved Regions with SCPs, and alert on any change to the logging configuration.
- Regulated workloads: agree the retention period and access model with the DPO before enabling content logging, because the logs inherit the sensitivity of every prompt.
Common failure patterns
- Assuming CloudTrail is enough: teams discover during an incident that they have call metadata but no prompt or response content.
- One Region only: logging is set up where the application runs, but stolen keys are used in another Region with no configuration.
- Logs readable by everyone with CloudWatch access: broad
logs:*read grants expose every customer prompt. - Never-expiring retention: log groups with no retention setting and buckets with no lifecycle rules accumulate personal data indefinitely.
- Shared roles: many applications calling Bedrock through one role makes
identity.arnuseless for attribution. - Silent delivery failure: a key policy or bucket policy change stops delivery and nobody alarms on the failure metrics.
Framework mapping
| Framework | Reference | Relevance |
|---|---|---|
| NIST SP 800-53 Rev 5 | AU-2 Event Logging; AU-6 Audit Record Review, Analysis, and Reporting | Deciding to log invocations and reviewing them |
| NIST SP 800-53 Rev 5 | AU-9 Protection of Audit Information; AU-11 Audit Record Retention | KMS, access control, masking and retention of logs |
| NIST CSF 2.0 | PR.PS-04; DE.CM-09 | Log records generated for monitoring; runtime monitoring |
| MITRE ATT&CK | T1496.004 Cloud Service Hijacking; T1078.004 Cloud Accounts | Model abuse with stolen credentials |
| MITRE ATLAS | AML.T0040 AI Model Inference API Access | Inference API use as an adversary technique |
| OWASP Top 10 for LLM Applications 2025 | LLM01, LLM02, LLM10 | Investigation of injection, leakage and unbounded consumption |
Practitioner checklist
- Enable model invocation logging in every account and Region where Bedrock is allowed.
- Send logs to both CloudWatch Logs and S3 so large and binary payloads are kept.
- Encrypt both destinations with customer managed symmetric KMS keys scoped by source conditions.
- Keep
aws:SourceAccountandaws:SourceArnconditions on the bucket policy, role trust policy and key policy. - Apply a CloudWatch Logs data protection policy and restrict
logs:Unmask. - Set retention on the log group and lifecycle rules on the S3 prefixes, matched to the privacy notice.
- Give each workload its own IAM role so
identity.arnattributes usage. - Alarm on delivery failure metrics and on any change to the logging configuration in CloudTrail.
- Build token spike, new principal and unapproved model detections.
- Review who can read the logs at least quarterly.
Standards and references
- AWS: Monitor model invocation using CloudWatch Logs and Amazon S3
- AWS: Monitor Amazon Bedrock API calls using CloudTrail
- AWS: Monitor bedrock-runtime inference using CloudWatch metrics
- AWS: Data protection in Amazon Bedrock
- AWS: Encrypt log data in CloudWatch Logs using AWS KMS
- AWS: Help protect sensitive log data with masking
- OWASP: Top 10 for LLM Applications 2025
- NIST: SP 800-53 Rev. 5 Security and Privacy Controls for Information Systems and Organizations
Related NHI Mgmt Group resources: Amazon Bedrock Security Guide · Amazon Bedrock Guardrails Configuration Guide · Secure AI logging · LLM Observability Guide