Troubleshooting Security Issues in ML and AI Systems
This lesson explains how to troubleshoot security controls that break workloads with generic errors, as the exam guide asks.
Learning outcomes
After completing this lesson, you will be able to:
- Trace AccessDenied errors through every policy layer.
- Diagnose network-related failures in private subnets.
- Use diagnostic tools such as CloudTrail and the policy simulator.
AccessDenied errors
An AccessDenied can come from many layers, and all must allow the action: the identity policy of the role, permissions boundaries, service control policies, resource policies (S3 bucket, ECR repository, KMS key), VPC endpoint policies and session policies. An explicit deny anywhere wins. For ML workloads, common causes are a missing iam:PassRole, an execution role without access to the S3 prefix, a KMS key policy that does not allow the role to decrypt, an ECR repository policy blocking cross-account pulls and Bedrock invocations of a model or inference profile not allowed by policy (or not available in the Region).
The following diagram shows three layers of failure for a training job in a secured environment, permissions, network and encryption, in the order they were fixed.

Access denied
Network-related failures
Jobs in private subnets fail or hang when they cannot reach a service: a training job cannot download data without an S3 gateway endpoint (or NAT); a container cannot pull images without ECR interface endpoints plus S3 for image layers; logs are missing without a CloudWatch Logs endpoint. With network isolation enabled, code that calls external APIs or downloads packages at runtime fails by design. Security groups without a self-referencing rule block distributed training communication.
Network failures
Diagnostic tools
Security problems in machine learning workloads usually appear as access denied errors or failed network connections, and several tools reveal the cause. AWS CloudTrail records the failed API call with its error code, the principal that made it and often the reason. The IAM policy simulator tests whether a principal's policies allow a given action. IAM Access Analyzer validates policies and finds unintended external access.
For network problems, VPC Flow Logs show rejected connections, for example a training job in a VPC that cannot reach Amazon S3 because no endpoint exists. The job's CloudWatch logs show the container's own error message. The following table maps common symptoms to causes.
| Symptom | Likely cause |
|---|---|
| AccessDenied on iam:PassRole when creating a job | Caller lacks PassRole for the execution role |
| Job fails reading encrypted S3 data | KMS key policy or grant missing for the execution role |
| Job hangs downloading data in a private subnet | No S3 gateway endpoint or NAT |
| Image pull fails in a private subnet | Missing ECR API, ECR Docker and S3 endpoints |
| Training code cannot reach PyPI | Network isolation or no internet path (expected) |
| Distributed training nodes cannot connect | Security group lacks self-referencing rule |
| Bedrock AccessDenied for one model only | Policy limits model ARNs or model not available |
A job that will not start
After the security team enables a new SCP and moves training into private subnets, a pipeline's training step fails first with AccessDenied and then, after a fix, hangs at "Downloading data".
- CloudTrail shows CreateTrainingJob denied by the SCP because the step did not pass a VolumeKmsKey; the pipeline is updated to set it.
- The job now starts but cannot reach S3: the private subnets have no S3 gateway endpoint. Adding one fixes the download.
- The execution role is added to the KMS key policy so it can decrypt the training data.
Working through the layers in order, policy, network and then encryption, resolves the issues systematically rather than by loosening controls.
Where can you find which call was denied and by which principal?
Show answer
In CloudTrail.
Exam Tips
Remember for the exam
- AccessDenied: check identity policy, PassRole, SCPs, resource and KMS key policies, endpoint policies.
- Private subnet jobs need S3 gateway and other VPC endpoints.
- Find the denied call and principal in CloudTrail.
- Test permissions with the IAM policy simulator.
- Network isolation blocks all outbound calls by design.