Auditing ML Systems with CloudTrail, Invocation Logs and AWS Config
This lesson explains how regulated organisations show who did what to ML systems, what models were asked and answered, and whether configurations meet policy, using AWS CloudTrail and AWS Config.
Learning outcomes
After completing this lesson, you will be able to:
- Distinguish CloudTrail management and data events.
- Use model invocation logging and other logs.
- Evaluate configurations with AWS Config rules.
AWS CloudTrail
CloudTrail records API calls as events: who (principal), what (action), when, from where and with what result. Management events cover control-plane calls such as creating endpoints, training jobs, knowledge bases, guardrails or changing model approval status. Data events, which must be enabled explicitly, cover high-volume data-plane operations such as S3 object reads and writes and, for supported services, invocations. A trail delivers events to S3 (with log file integrity validation) and optionally to CloudWatch Logs; an organisation trail covers all accounts.
Which log?
Model invocation logging and other logs
Bedrock model invocation logging records the full request and response of model invocations, including prompts, outputs and metadata, to CloudWatch Logs or S3, which CloudTrail does not capture. Because these logs may contain sensitive data, encrypt them with KMS, restrict access, and use CloudWatch Logs data protection policies to mask sensitive values. SageMaker AI data capture records endpoint requests and responses. Container and job logs go to CloudWatch Logs with retention policies matching regulatory requirements.
The following diagram matches each regulatory requirement for an ML platform to the evidence that proves it.

AWS Config
AWS Config records resource configurations over time and evaluates them against rules. Managed rules exist for SageMaker AI, such as notebook instances without direct internet access, endpoint configurations with KMS keys and notebook instances with KMS keys, and custom rules can check other settings. Conformance packs group rules for a framework, and remediation actions can fix non-compliant resources. The following table summarises the services.
| Question | Service |
|---|---|
| Who created, changed or deleted an ML resource? | CloudTrail management events |
| Who read the training data objects? | CloudTrail S3 data events |
| What did the model receive and return? | Bedrock invocation logging, SageMaker data capture |
| Are resources configured according to policy? | AWS Config rules and conformance packs |
| How is each model documented and traced? | Model cards and lineage (next lesson) |
AWS Config
Preparing for an audit
A bank's regulator requires evidence that model endpoints are encrypted, that every model change is traceable to a person, and that customer-facing AI responses are retained for 7 years.
- An organisation CloudTrail trail with log file validation, delivered to an Object Lock bucket in a log archive account.
- AWS Config conformance pack with SageMaker AI encryption and network rules, with compliance history.
- Bedrock invocation logging to an encrypted S3 bucket with a 7-year lifecycle and restricted access.
CloudTrail alone would not show the AI responses, and invocation logging alone would not show who changed the configuration; the audit needs both, plus Config for configuration compliance.
What must be enabled to record S3 object access in CloudTrail?
Show answer
Data events.
Exam Tips
Remember for the exam
- Who did what: CloudTrail; S3 object access needs data events.
- Prompts and responses: Bedrock model invocation logging.
- Configuration compliance: AWS Config rules and conformance packs.
- Encrypt and restrict access to invocation logs; mask sensitive data.
- Organization trails cover all accounts.