Lesson 5 of 5 Securing ML and AI Workloads

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.

Working through the layers in order. CloudTrail shows CreateTrainingJob denied by the SCP because no volume KMS key was passed; once set, the job hangs downloading data because the private subnets have no S3 gateway endpoint; and the execution role must be added to the KMS key policy to decrypt the training data.
The scenario is illustrative.
Troubleshooting scenario

Access denied

Exam skills 4.3.5

Find the cause of each access error, one at a time.

Log in to try this activity Interactive activities are free with an account.

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.

Scenario questions

Network failures

Exam skills 4.3.5 · 4.3.6

Diagnose training and endpoint failures caused by network settings.

Log in to try this activity Interactive activities are free with an account.

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.

SymptomLikely cause
AccessDenied on iam:PassRole when creating a jobCaller lacks PassRole for the execution role
Job fails reading encrypted S3 dataKMS key policy or grant missing for the execution role
Job hangs downloading data in a private subnetNo S3 gateway endpoint or NAT
Image pull fails in a private subnetMissing ECR API, ECR Docker and S3 endpoints
Training code cannot reach PyPINetwork isolation or no internet path (expected)
Distributed training nodes cannot connectSecurity group lacks self-referencing rule
Bedrock AccessDenied for one model onlyPolicy limits model ARNs or model not available
Worked example

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.

Check yourself

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.