- Produce a complete audit trail of SageMaker and other AWS API activity.
- Retain and protect logs to help meet compliance frameworks (HIPAA, GDPR, PCI).
- Detect unusual or unauthorized API calls for security monitoring.
- Support troubleshooting and post-incident forensics.



- SageMaker (and other AWS services) emits API calls.
- AWS CloudTrail records those events.
- CloudTrail delivers log files to an S3 bucket for secure storage.
- CloudWatch and EventBridge consume events for monitoring or automation.
- Athena queries S3-stored logs for forensic and operational analysis.

- Send CloudTrail events to CloudWatch Logs so you can create metric filters and dashboards.
- Use EventBridge rules to match suspicious patterns and route to SNS, Lambda, or other targets.
- Typical alerts: anomalous access, spikes in failed API calls, sudden increases in latency, or unexpected configuration changes.

- Who invoked a given SageMaker endpoint and when?
- What IP addresses were used to access management APIs?
- Which model served a given request on a multi-model endpoint?

- A rule detects a compromised endpoint and invokes a Lambda to isolate it (update security groups, remove endpoint).
- A detected drift in configuration triggers a CodePipeline job to rollback or redeploy.
- Re-training jobs are queued automatically when data-access anomalies are detected.

- CloudTrail trail(s) that capture management and chosen data events.
- CloudWatch Log groups with metric filters and dashboards.
- An S3 bucket with server-side encryption (SSE-KMS), lifecycle rules, and strict access policies.
- IAM roles and KMS keys scoped to least privilege.
- EventBridge rules and Lambda functions for automated responses.

TargetModel parameter in request parameters. When CloudTrail records that parameter, Athena queries can identify which model served the request—useful for per-model usage, billing allocation, or incident investigation.


- Deliver logs to an encrypted S3 bucket (enable SSE-KMS).
- Enforce IAM least privilege—use roles and avoid long-lived credentials.
- Use AWS Config to continuously audit resource configuration and detect drift.
- Trigger alerts on non-compliance and use Lambda for automated remediation (e.g., revert risky changes).
- Use S3 features like bucket policies, object lock, and MFA Delete when required by policy.

Always enable server-side encryption (SSE-KMS) on the S3 bucket that stores CloudTrail logs. Grant access using IAM roles scoped to least privilege. Consider S3 bucket policies, object lock, and MFA Delete when compliance requires immutability and stronger protection.
- Keep recent logs in S3 Standard for fast access.
- Transition older logs to S3 Glacier or Glacier Deep Archive for long-term retention.
- Delete or archive logs only after meeting your compliance retention requirements.
- Not enabling CloudTrail or leaving gaps for SageMaker and other critical services.
- Leaving logs in standard storage indefinitely without lifecycle rules.
- Ignoring alerts—unseen notifications can allow incidents to escalate.
- Hard-coding IAM credentials or using overly permissive roles without periodic audits.
- Enable CloudTrail to capture all SageMaker and relevant API activity.
- Deliver logs to an encrypted S3 bucket and apply lifecycle policies to archive older logs.
- Use CloudWatch metric filters and alarms for anomalous activity.
- Use Athena to run queries for forensic analysis and operational investigations.
- Automate incident responses with EventBridge + Lambda + CI/CD where appropriate (e.g., retrain a model or isolate a compromised endpoint).
- Enforce IAM least privilege, use KMS for key management, require TLS in transit, and isolate resources in VPCs when necessary.
- Optimize costs by retaining only required logs and archiving old data per retention policies.


- AWS CloudTrail User Guide: https://docs.aws.amazon.com/cloudtrail/latest/userguide/cloudtrail-user-guide.html
- Amazon SageMaker: https://aws.amazon.com/sagemaker/
- Amazon S3 storage classes and lifecycle: https://aws.amazon.com/s3/storage-classes/
- Amazon Athena: https://aws.amazon.com/athena/
- Amazon CloudWatch: https://aws.amazon.com/cloudwatch/
- Amazon EventBridge: https://aws.amazon.com/eventbridge/
- AWS Lambda: https://aws.amazon.com/lambda/
- AWS KMS: https://aws.amazon.com/kms/
- AWS Config: https://aws.amazon.com/config/