Join our Newsletter — 33% off our NHI Course
Home› Guides› Amazon Bedrock Model Invocation Logging Guide: Setup, Privacy…
Guide AI Platforms

Amazon Bedrock Model Invocation Logging Guide: Setup, Privacy and Detection Use

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

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, InvokeModel and InvokeModelWithResponseStream on the bedrock-runtime endpoint.
  • 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/Bedrock metrics 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:

FieldContentSecurity use
schemaType, schemaVersionAlways ModelInvocationLog, plus versionParser routing
timestampInvocation time (ISO 8601)Timeline building
accountId, regionCalling account and RegionSpotting use in unexpected Regions
requestIdUnique request identifierJoin to CloudTrail and application logs
operationFor example Converse or InvokeModelBaseline of call types per workload
modelIdModel ID or inference profile IDUnapproved model detection
identity.arnIAM or STS ARN of the caller, captured automaticallyAttribution to the workload identity
requestMetadataOptional caller-supplied key-value tagsTeam, application or environment attribution
input.inputBodyJson, input.inputTokenCountRequest body (up to 100 KB inline) and token countPrompt content review, injection investigation, cost
output.outputBodyJson, output.outputTokenCountResponse body (up to 100 KB inline) and token countData 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-runtime endpoint, including the OpenAI-compatible Responses and Chat Completions APIs on that endpoint, and that calls through other endpoints such as bedrock-mantle are 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 InvokeAgent and RetrieveAndGenerate are 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.

ChoiceStrengthsConstraintsFits
CloudWatch Logs onlyLogs Insights queries, metric filters, subscription filters, data protection maskingInline bodies only (100 KB); no large or binary payloadsText-only workloads needing fast detection
S3 onlyComplete payloads, lifecycle rules, low storage cost, Object Lock optionQuerying needs Athena or a SIEM pipelineArchive and investigation, multimodal workloads
BothFast queries plus complete content; CloudWatch entries reference S3 objectsTwo stores to secure and retainMost production estates

Implementation steps

  1. Create the KMS keys (symmetric customer managed keys) for the S3 bucket and the log group, with key policies described in the next section.
  2. 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.
  3. Add the bucket policy allowing bedrock.amazonaws.com s3:PutObject on <prefix>/AWSLogs/<account>/BedrockModelInvocationLogs/*, conditioned on aws:SourceAccount and aws:SourceArn (arn:aws:bedrock:<region>:<account>:*). The console attaches it automatically if you hold s3:GetBucketPolicy and s3:PutBucketPolicy; review it either way.
  4. Create the log group with aws logs create-log-group --kms-key-id, and set a retention period on it.
  5. Create the IAM role for CloudWatch delivery: trust policy for bedrock.amazonaws.com sts:AssumeRole with the same aws:SourceAccount and aws:SourceArn conditions; permissions limited to logs:CreateLogStream and logs:PutLogEvents on the aws/bedrock/modelinvocations log stream ARN.
  6. Enable logging in a non-production account first, select data types, run test invocations and confirm entries arrive in both destinations.
  7. Alarm on delivery: Bedrock emits ModelInvocationLogsCloudWatchDeliveryFailure, ModelInvocationLogsS3DeliveryFailure and ModelInvocationLargeDataS3DeliveryFailure in AWS/Bedrock. Alarm on any non-zero value.
  8. Roll out by Region and account using infrastructure as code, so every Region where Bedrock is allowed has the same configuration.
  9. Roll back with DeleteModelInvocationLoggingConfiguration if 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.com kms:GenerateDataKey, conditioned on aws:SourceAccount and aws:SourceArn.
  • KMS for CloudWatch Logs: the key policy must allow logs.<region>.amazonaws.com with the kms:EncryptionContext:aws:logs:arn condition; use ArnEquals to 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:Unmask see original values. Masking applies only to events ingested after the policy is set, and the LogEventsWithFindings metric 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:Unmask and S3 GetObject on 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.

StoreRetention controlSuggested approach
CloudWatch Logs groupLog group retention settingShort (for example 30 to 90 days) for hot detection, matched to your privacy notice
S3 invocation logsLifecycle expiration, storage class transitionsLonger only where an investigation or legal need is documented
S3 large data prefixSeparate lifecycle rule on the data prefixSame or shorter than the log entries that reference it
Central security copyLifecycle in the security account, optional Object LockIntegrity 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.

DetectionDataLogicThreat mapping
Token volume spikeInputTokenCount, OutputTokenCount, Invocations metrics; per-principal sums of token counts in logsAnomaly band or threshold per ModelId and per identity.arnATT&CK T1496.004 Cloud Service Hijacking; OWASP LLM10:2025 Unbounded Consumption
New principal using modelsidentity.arnPrincipal not seen in the last 30 days, or a human user ARN where only workload roles are expectedATT&CK T1078.004 Cloud Accounts; ATLAS AML.T0040 AI Model Inference API Access
Unapproved model or RegionmodelId, regionNot on the approved model list or outside allowed RegionsPolicy violation, possible credential misuse
Sensitive data in prompts or outputsLogEventsWithFindings metric, masking audit findingsFindings above baseline for a workloadOWASP LLM02:2025 Sensitive Information Disclosure
Prompt injection investigationinputBodyJson, outputBodyJsonRetrospective search for known injection strings after an alertOWASP LLM01:2025 Prompt Injection
Throttling and error burstsInvocationThrottles, InvocationClientErrorsBurst from one principal suggests automated abuse or probingT1496.004
Logging tamperingCloudTrailCalls to DeleteModelInvocationLoggingConfiguration or PutModelInvocationLoggingConfiguration; delivery failure metricsNIST 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.arn maps to a named workload role (target 100%).
  • Exposure: number of principals with read or logs:Unmask access to invocation logs (keep it small and reviewed).
  • Retention conformity: log groups and buckets whose retention matches the documented policy.

Relationship with CloudTrail

AspectCloudTrailModel invocation logging
Default stateManagement events recorded by default; data events need advanced event selectors and are chargedDisabled by default
InvokeModel, Converse and streaming variantsManagement eventsLogged with bodies when enabled
InvokeAgent, Retrieve, RetrieveAndGenerate, InvokeFlow, ApplyGuardrailData 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 contentMetadata such as modelId, per AWS examples; use invocation logging for contentRecorded (inline up to 100 KB, larger in S3)
Caller identityuserIdentityidentity.arn
Token countsStream-completion service events carry inputTokens and outputTokensinputTokenCount, outputTokenCount
Best forAudit of who did what, configuration changesContent 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.arn useless for attribution.
  • Silent delivery failure: a key policy or bucket policy change stops delivery and nobody alarms on the failure metrics.

Framework mapping

FrameworkReferenceRelevance
NIST SP 800-53 Rev 5AU-2 Event Logging; AU-6 Audit Record Review, Analysis, and ReportingDeciding to log invocations and reviewing them
NIST SP 800-53 Rev 5AU-9 Protection of Audit Information; AU-11 Audit Record RetentionKMS, access control, masking and retention of logs
NIST CSF 2.0PR.PS-04; DE.CM-09Log records generated for monitoring; runtime monitoring
MITRE ATT&CKT1496.004 Cloud Service Hijacking; T1078.004 Cloud AccountsModel abuse with stolen credentials
MITRE ATLASAML.T0040 AI Model Inference API AccessInference API use as an adversary technique
OWASP Top 10 for LLM Applications 2025LLM01, LLM02, LLM10Investigation 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:SourceAccount and aws:SourceArn conditions 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.arn attributes 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

Related NHI Mgmt Group resources: Amazon Bedrock Security Guide · Amazon Bedrock Guardrails Configuration Guide · Secure AI logging · LLM Observability Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.