c1.4 Log every model invocation with CloudTrail and CloudWatch
Capture who invoked which model, when, and with what configuration, so inference activity is auditable and anomalies are detectable.
Implementation guidance
How to implement on AWS
Enable CloudTrail for Amazon Bedrock API calls and turn on Bedrock model invocation logging to CloudWatch/S3. Track invocation rate, latency, token usage, and error rate with CloudWatch metrics, and alarm on deviations from baseline.
Make inference activity auditable
Two different logs answer two different questions:
- AWS CloudTrail records the control-plane and API activity — who called which Bedrock operation, from where, and when. This is on by default for management events and is your audit trail of who did what.
- Model invocation logging captures the data plane — the actual prompts, completions, and invocation metadata for calls made through the
bedrock-runtimeendpoint. This is off by default and you must enable it explicitly.
Together they let you reconstruct both the administrative actions and the inference itself.
Turn on model invocation logging
Enable invocation logging and send it to CloudWatch Logs (and/or S3). CloudWatch is convenient for metric filters and alarms; S3 is better for cheap long-term retention. The delivery role must let Bedrock write to the destination:
aws bedrock put-model-invocation-logging-configuration \
--logging-config '{
"cloudWatchConfig": {
"logGroupName": "/aws/bedrock/model-invocations",
"roleArn": "arn:aws:iam::111122223333:role/BedrockInvocationLoggingRole"
},
"textDataDeliveryEnabled": true,
"imageDataDeliveryEnabled": false,
"embeddingDataDeliveryEnabled": true
}'
Note: invocation logging only captures calls through the bedrock-runtime endpoint (InvokeModel, Converse, and the OpenAI-compatible APIs on that endpoint). Calls through other endpoints are not captured.
Alarm on the signals that matter
Once logs land in CloudWatch, add metric filters and alarms for things worth waking up for — a spike in guardrail interventions, throttling errors, or an unusual jump in invocation volume from one principal. Prompts and completions can contain sensitive data, so encrypt the destination with your customer managed key (see the KMS control) and scope who can read the log group or bucket.
Keep an eye on cost
- CloudWatch Logs bills for ingestion and storage; prompts/completions can be large, so route high-volume workloads to S3 and keep CloudWatch for a shorter alerting window.
- Set an S3 lifecycle rule to expire or archive old invocation logs.
Acceptance criteria
CloudTrail records Bedrock API calls; invocation logs are delivered; CloudWatch alarms exist for anomalous invocation patterns.
Practical implementation
How this control is implemented in each reference architecture:
CloudTrail and Bedrock invocation logs from the Generative AI account flow to the central Log archive account, where they are immutable and monitored.
- Enable organization CloudTrail capturing Bedrock management and data events, and turn on Bedrock model-invocation logging in the Generative AI account.
- Deliver those logs to the central WORM (Object Lock) bucket in the Log archive account so inference activity is tamper-resistant and centrally retained.
- Publish invocation rate, latency, token usage, and error-rate metrics to CloudWatch and alarm on deviations from baseline.
How to validate: CloudTrail shows Bedrock calls; invocation logs land in the Log archive bucket under Object Lock; a simulated invocation spike triggers a CloudWatch alarm.
Avoid: Logging only into the same account that runs the workload. An attacker who reaches that account can tamper with the evidence; ship logs to a separate Log archive account.
CloudTrail and invocation logs stay in-account but are exported to an access-controlled, Object-Lock bucket you can later centralize when you graduate.
- Enable CloudTrail for Bedrock API calls and turn on Bedrock model-invocation logging to CloudWatch and S3.
- Send logs to a dedicated S3 bucket with Object Lock and a restrictive bucket policy, separate from application data, so they resist tampering even within one account.
- Create CloudWatch metrics and alarms for invocation rate, token usage, and error rate to catch abuse or runaway cost.
How to validate: CloudTrail records Bedrock calls; invocation logs are delivered to the Object-Lock bucket; an abnormal invocation pattern raises an alarm.
Avoid: Writing logs to a bucket the application role can delete or overwrite. Isolate the log bucket with its own policy and Object Lock so runtime credentials cannot erase the trail.
Threats addressed
- Undetected abuse or data access when invocations are not logged.
- No audit trail to reconstruct an incident.
AWS services
Pricing
Bedrock does not charge for enabling invocation logging itself; you pay the standard CloudWatch Logs and/or S3 charges for the data delivered and stored. CloudTrail management events are free; data events (if enabled) are billed per event. See Monitor model invocation using CloudWatch Logs and Amazon S3.
Framework mappings
OWASP GenAI/LLM Top 10 (2026)
- LLM02 Sensitive Information Disclosure
NIST AI Risk Management Framework (AI 100-1)
- MEASURE.3 Mechanisms for tracking AI risks are in place
- MANAGE.4 Risk treatments, monitoring and response are documented and applied
AWS Well-Architected Generative AI Lens (Security)
- GENSEC01-BP04 Implement access monitoring to generative AI services and foundation models
- GENSEC03-BP01 Implement control plane and data access monitoring
Learning resources
References
- AWS SRA for AI — Capability 1, Defense in depth
AI Security Maturity Model