SaveMyCert
Log in
5 of 5 free questions left today·for 30 a day
Operating, Monitoring, and Securing ML and AI Solutions

Securing ML and AI Workloads on AWS: IAM, VPC Isolation, Auditing and Bedrock Guardrails (MLA-C02)

21 min readMLA-C02 · Operating, Monitoring, and Securing ML and AI SolutionsUpdated

Securing ML and AI workloads means applying least-privilege IAM, network isolation, encryption, audit logging and responsible-AI safeguards to the data, models, endpoints, foundation models and agents of an ML system. For the MLA-C02 exam that covers scanning code and container images in CI/CD with Amazon Inspector, SageMaker AI execution roles and IAM condition keys, VPC and network isolation for training and Studio, CloudTrail and AWS Config for audit and compliance, choosing between IAM credentials and Amazon Bedrock API keys, and protecting prompts and responses with Amazon Bedrock Guardrails. This lesson explains how each control works, where it applies, and what it does and does not protect.

What you’ll learn
  • Choose between a pre-push Inspector scan in CodeBuild, continuous Inspector ECR scanning and Inspector code security to secure ML CI/CD pipelines.
  • Grant least-privilege access to ML artifacts with prefix-scoped S3 permissions, KMS key policies, scoped iam:PassRole and Model Registry resource policies.
  • Enforce VPC placement, network isolation and encryption at creation time with SageMaker AI condition keys in Deny statements and SCPs.
  • Isolate training jobs, Studio domains and Bedrock calls with private subnets, network isolation, inter-container encryption and VPC endpoints.
  • Audit ML and AI activity with CloudTrail management and data events, model invocation logging and AWS Config rules and conformance packs.
  • Select IAM role credentials or short-term or long-term Amazon Bedrock API keys, and govern API keys with IAM condition keys.
  • Configure Amazon Bedrock Guardrails policies, enforce them with bedrock:GuardrailIdentifier, and mitigate prompt injection and excessive agency in agents.

What does securing ML and AI workloads on AWS involve?

Securing ML and AI workloads means controlling who and what can reach your data, models and endpoints, keeping training and inference traffic on networks you control, recording every action for audit, and putting safeguards around what foundation models (FMs) and agents can say and do. Task 4.3 groups nine skills, and each maps to a small set of AWS mechanisms:

SkillMain mechanisms
Secure CI/CD by scanning code and imagesAmazon Inspector (ECR enhanced scanning, SBOM Generator + Inspector Scan API, code security); Amazon CodeGuru (legacy, see below)
Least-privilege access to ML and AI artifactsPrefix-scoped S3 permissions, KMS key policies, resource-based policies on Model Registry model package groups
IAM policies and roles for users and applicationsSageMaker AI execution roles, iam:PassRole, SageMaker and Bedrock condition keys, SCPs
Monitoring, auditing, compliance and loggingAWS CloudTrail (management and data events), AWS Config managed rules and conformance packs, Bedrock model invocation logging
Troubleshooting security issuesReading AccessDenied messages, KMS permissions, missing VPC endpoints
VPCs, subnets and security groups for isolationTraining job VPC config, network isolation, inter-container encryption, Studio VPC-only mode, VPC endpoints
Identifying and mitigating ML and AI risksPrompt-injection and excessive-agency controls for agents, least-privilege tools, artifact integrity
Choosing credentials for FMsIAM role credentials, short-term and long-term Amazon Bedrock API keys
Safeguards and sensitive-data protectionAmazon Bedrock Guardrails, ApplyGuardrail, CloudWatch Logs data protection

Monitoring model quality and drift belongs to Task 4.1 and cost and performance tuning to Task 4.2. Basic endpoint VPC configuration and CI/CD pipeline design are deployment topics in Domain 3; this lesson covers the security controls layered on top of them.

How do you scan ML code and container images in a CI/CD pipeline?

Use Amazon Inspector for both images and code, and choose the scanning point from the requirement: a scan inside the build stops a vulnerable image before it is stored, and continuous registry scanning catches new vulnerabilities in images that are no longer being rebuilt. Custom SageMaker AI training and inference containers often run in production for months, so the second point matters as much as the first.

MechanismWhen it runsWhat it gives you
Amazon ECR basic scanning (scan on push or manual)When an image is pushed or a scan is requestedOS package findings for that moment only
Amazon Inspector enhanced scanning, continuousOn push, then automatically again whenever new CVE data affects the image's packagesOS and programming-language package findings in Inspector, with no scheduling by the team
Amazon Inspector SBOM Generator + Inspector Scan API in CodeBuild (or a CI plugin)Inside the build, before the pushA vulnerability report, and a build that fails on findings above your threshold, so the image never reaches the registry
Amazon Inspector code securityOn every change in connected GitHub or GitLab repositories, and on a scheduleStatic analysis (SAST) of first-party code, software composition analysis (SCA) of open source dependencies, and infrastructure as code (IaC) scanning, with findings in pull requests and in Inspector

Any registry-side scan, basic or enhanced, runs after the image has landed in ECR. If a rule says a vulnerable image must never be stored, the scan has to happen in the build: the SBOM Generator produces a CycloneDX software bill of materials from the built image, the Inspector Scan API returns the vulnerabilities, and the build step fails. A requirement for both a pre-push gate and ongoing re-evaluation needs both controls.

CodeGuru availability. The exam guide names Amazon CodeGuru as an example. Amazon CodeGuru Reviewer stopped accepting new repository associations on 7 November 2025 (existing associations keep working), and Amazon CodeGuru Security was discontinued on 20 November 2025. For a new setup, AWS points to Amazon Inspector code security. Neither CodeGuru service scanned the packages inside container images; that has always been Inspector's job. IaC scanning checks templates before anything is deployed, whereas AWS Config evaluates resources only after they exist.

Integrity controls complement scanning: ECR tag immutability ensures the image behind a scanned tag cannot be silently replaced.

How do you configure least-privilege access to ML artifacts and execution roles?

Grant each job or principal only the actions it needs on only the resources it uses, and remember that encrypted and cross-account artifacts need permissions in more than one place. ML artifacts are training data, features, model artifacts (model.tar.gz), container images and Model Registry entries.

Scoping S3 to prefixes

A training pipeline that reads one prefix and writes another needs s3:GetObject on the input prefix (arn:aws:s3:::bucket/project/curated/*), s3:PutObject on the output prefix, and s3:ListBucket on the bucket ARN restricted with an s3:prefix condition. Object actions take object ARNs and ListBucket takes the bucket ARN, so a ListBucket on bucket/prefix/* grants nothing, while an unconditioned ListBucket reveals every key in the bucket, including sensitive prefixes the job never uses. Avoid s3:* even on a narrow prefix: it includes delete and permission-changing actions.

KMS-encrypted artifacts

With SSE-KMS and a customer managed key, S3 decrypts objects with the key on the caller's behalf, so the reader also needs kms:Decrypt (and a writer needs kms:GenerateDataKey). In the same account the key policy can grant it directly or delegate to IAM policies. Across accounts, both are required: the key policy in the owning account must allow the external role, and the role's identity policy must allow the key.

Sharing models across accounts

A SageMaker Model Registry model package group can carry a resource-based policy that lets principals in another account describe and use its model packages. A typical central-registry setup therefore needs three grants for a production deployment role: the model package group policy, read access to the artifact prefix (bucket policy plus identity policy), and kms:Decrypt on the artifact key (key policy plus identity policy). If the deployment role is also passed as the production model's execution role, that same role is the one that must read and decrypt the artifacts.

Execution roles and iam:PassRole

A SageMaker AI job or endpoint runs with its execution role, not with the identity of the person who created it, and the creator needs iam:PassRole to hand that role to SageMaker AI. Keeping the two identities apart solves most permission puzzles in this task.

Caller (user, notebook, pipeline role)Execution role
Used forThe API call, such as CreateTrainingJob, CreateProcessingJob or CreateEndpointEverything the job does once it runs: reading inputs, writing outputs, pulling images, decrypting with KMS, writing logs
Needssagemaker:Create* plus iam:PassRole on the execution roleA trust policy for sagemaker.amazonaws.com and permissions for the job's resources
Typical failureAccessDenied for iam:PassRole when the job is createdS3 or KMS AccessDenied after the job starts

An engineer who can open a bucket from a notebook has proved only that their identity can read it; a job that then fails on download needs the permission on its execution role. Grants for the job's data always target the execution role, because the job calls S3 and KMS with that role's credentials.

A least-privilege iam:PassRole statement names the one execution role ARN as its Resource and adds the iam:PassedToService condition with sagemaker.amazonaws.com. A wildcard Resource lets the user pass any role, including a more privileged one, which is a privilege-escalation path. iam:PassRole lives in the caller's identity policy; the execution role's trust policy only decides which service may assume the role.

How do you enforce ML security settings with IAM conditions and SCPs?

Reject non-compliant ML resources at creation time with explicit Deny statements that test SageMaker AI condition keys, in identity policies or in service control policies (SCPs) for a whole organization. Preventive controls stop a bad request; AWS Config and SDK defaults only report it later or can be skipped.

Useful SageMaker AI condition keys include sagemaker:VpcSubnets and sagemaker:VpcSecurityGroupIds (VPC placement), sagemaker:NetworkIsolation, sagemaker:InterContainerTrafficEncryption, sagemaker:VolumeKmsKey (storage volumes attached to job instances) and sagemaker:OutputKmsKey (output artifacts in S3), sagemaker:InstanceTypes, and for notebook instances sagemaker:DirectInternetAccess and sagemaker:RootAccess.

Four evaluation rules decide whether such a policy works:

  • An explicit Deny beats any Allow. If users keep a broad policy such as sagemaker:*, adding a narrower conditional Allow restricts nothing; only a Deny does.
  • Conditions in one statement are ANDed. A single Deny that requires both "no VPC" and "no network isolation" fires only when both are missing. To catch either omission, write one Deny per requirement.
  • A missing key behaves differently by operator. A negated operator such as StringNotEquals evaluates to true when the key is absent, so one Deny with StringNotEquals on sagemaker:VolumeKmsKey rejects both a wrong key and no key. A positive operator such as Bool does not match an absent key, so a Deny on sagemaker:NetworkIsolation = false misses requests that omit the setting; use BoolIfExists, or pair it with a Null check (which on its own tests only whether the key is present).
  • Nothing in a member account overrides an SCP deny. Identity policies, permissions boundaries and resource policies cannot grant past it.

How do you isolate training jobs and ML systems in a VPC?

Attach jobs to private subnets and security groups in your VPC, give them VPC endpoints for the AWS services they call, and turn on network isolation when the container must make no outbound calls at all. These are separate settings with separate effects:

SettingWhat it doesWhat it does not do
VPC config (subnets + security groups)Places the job's network interfaces in your subnets, so your routes, endpoints and firewalls applyBlock outbound traffic by itself; a NAT gateway or endpoint still gives the container a path out
Network isolation (EnableNetworkIsolation)Removes all outbound network access from the container, even to AWS services and even inside a VPC. SageMaker AI still copies input channels in and uploads model artifacts outEncrypt anything
Inter-container traffic encryption (EnableInterContainerTrafficEncryption)Encrypts traffic between instances in distributed training (at some cost in training time)Restrict where traffic goes
Volume and output KMS keys (VolumeKmsKeyId, KmsKeyId)Encrypt data at rest on storage volumes and in output artifactsProtect data in transit

Under network isolation a script that downloads something at start-up (for example a file from a public model hub or a library from a package index) will fail. Stage those files in S3 and pass them as an extra input channel; SageMaker AI delivers channels to the container even though the container cannot fetch them itself.

A job in private subnets without a NAT gateway or an S3 endpoint has no route to S3, and the symptom is a connection timeout, not AccessDenied. An S3 gateway endpoint added to the subnets' route tables restores access privately.

Studio and Bedrock private connectivity

A SageMaker AI domain in Public internet only mode (the default) sends Studio traffic over a SageMaker-managed internet path that bypasses your VPC controls. VPC only mode routes all Studio traffic through your subnets, and because there is no managed internet path, you must create interface endpoints for the SageMaker API, SageMaker runtime, STS and the other services users need (or provide a NAT path, which reintroduces internet access).

Amazon Bedrock uses interface (AWS PrivateLink) endpoints only; there is no gateway endpoint. The service names differ by plane: bedrock-runtime for inference (InvokeModel, Converse), bedrock for the control plane, and bedrock-agent / bedrock-agent-runtime for agents and knowledge bases. With private DNS enabled, existing SDK calls use the endpoint without code changes. To make stolen credentials useless outside the VPC, add a Deny on the inference actions unless aws:SourceVpce equals your endpoint ID.

How do you audit and monitor compliance of ML and AI systems?

Use AWS CloudTrail to record who called which API and when, Bedrock model invocation logging to record what was sent to and returned by models, and AWS Config to evaluate whether resources stay compliant over time. Each answers a different question.

CloudTrail: management events versus data events

Event typeML and AI examplesRecorded by default?
Management eventsSageMaker AI control plane (CreateTrainingJob, CreateEndpoint, DeleteEndpoint); Bedrock InvokeModel and ConverseYes: CloudTrail event history keeps 90 days with no setup; a trail is needed for longer retention
Data eventsSageMaker AI InvokeEndpoint (resource type AWS::SageMaker::Endpoint); Bedrock InvokeAgent (AWS::Bedrock::AgentAlias), Retrieve and RetrieveAndGenerate (AWS::Bedrock::KnowledgeBase), InvokeFlow, ApplyGuardrailNo: add advanced event selectors for the resource types to a trail (or event data store), and only from that point on

CloudTrail records the caller, time, source and resource, never the prompt or payload. For prompt and response text, turn on Amazon Bedrock model invocation logging (to CloudWatch Logs or S3). For SageMaker AI endpoints, data capture records payloads for monitoring, but it is not an audit of caller identity. CloudTrail Lake closed to new customers on 31 May 2026 (existing event data stores keep working), so for a new account rely on trails, event history and CloudWatch.

AWS Config: continuous compliance with history

AWS Config managed rules evaluate SageMaker AI resources continuously and keep a configuration history. Examples include sagemaker-notebook-no-direct-internet-access, sagemaker-notebook-instance-root-access-check, sagemaker-notebook-instance-inside-vpc, sagemaker-endpoint-configuration-kms-key-configured, sagemaker-model-isolation-enabled (network isolation on SageMaker AI models) and sagemaker-model-in-vpc (models attached to a VPC). Each rule checks one setting, so match the rule to the exact property the requirement names. Config is detective: it reports a non-compliant resource after it exists, while IAM and SCP conditions prevent it.

Across AWS Organizations, deploy the rules as an organization conformance pack from the management account or a delegated administrator (new accounts are covered automatically) and create an organization aggregator for one consolidated compliance view. AWS Audit Manager cannot be set up in new accounts or Regions from 30 April 2026; AWS points new users to Config conformance packs.

How do you troubleshoot security issues in ML and AI systems?

Start from the exact error: an AccessDenied names the action and often the policy type that refused it, and a timeout usually means a missing network path rather than a permission. Then fix the identity or resource the evidence points at, not the one you assume.

SymptomLikely causeFix
AccessDenied for iam:PassRole when creating a jobThe caller cannot pass the execution roleAllow iam:PassRole on that role ARN with iam:PassedToService
S3 AccessDenied after the job starts, though the engineer can read the bucketThe execution role lacks the S3 permissionGrant it on the execution role
S3 AccessDenied on an SSE-KMS bucket while s3:GetObject is allowed; CloudTrail shows a failed kms:DecryptMissing KMS permissionAllow kms:Decrypt for the role in the key policy, or in an IAM policy the key policy permits
Connection timeout to S3 or an AWS API from private subnetsNo route: no NAT gateway, no VPC endpointAdd the S3 gateway endpoint or the required interface endpoints
AccessDenied "with an explicit deny in a service control policy"An organization SCPAsk the organization administrators to change the SCP; nothing in the account can override it
AccessDenied citing a permissions boundaryThe boundary does not include the actionChange the boundary (an identity-policy Allow is not enough)

Effective permission is the intersection of what every applicable policy allows, minus any explicit deny. Adding an Allow never fixes an explicit deny, and a failed call named in CloudTrail (for example kms:Decrypt by the execution role) is the fastest pointer to the missing grant.

Which credentials should applications use to access foundation models?

Applications running on AWS should call Amazon Bedrock with IAM role credentials (an EC2 instance profile, ECS task role, Lambda execution role or EKS service account role), which the AWS SDK obtains and refreshes automatically with nothing to store. Amazon Bedrock API keys exist for tools and clients that accept only a bearer-style API key.

CredentialHow it is createdLifetime and permissionsUse for
IAM role credentials (SigV4)Assumed automatically by the compute serviceTemporary, rotated by AWS; the role's permissionsProduction applications on AWS
Short-term Bedrock API keyGenerated from an existing IAM principal's sessionExpires with the session, at most 12 hours; valid only in the Region where it was generated; inherits the generating principal's permissionsTools that need an API key, without creating IAM users
Long-term Bedrock API keyA service-specific credential attached to an IAM user; generating one in the console creates that IAM user for you, so it is unavailable where IAM users are not allowedLasts until its configured expiry or deletion; the IAM user's permissionsExploration only; AWS does not recommend it for production

Because a short-term key expires within hours, whatever uses it must be able to obtain a fresh one, for example by generating it from the running principal's own credentials.

Governing API keys. Long-term keys are created with iam:CreateServiceSpecificCredential; deny it when iam:ServiceSpecificCredentialServiceName is bedrock.amazonaws.com to stop creation (iam:ServiceSpecificCredentialAgeDays limits how long new keys may live). Requests made with any API key are authorized through bedrock:CallWithBearerToken; deny it when bedrock:bearerTokenType is LONG_TERM to disable existing long-term keys while short-term keys keep working. Applied as SCPs, these controls cover the whole organization.

How do Amazon Bedrock Guardrails protect AI applications?

Amazon Bedrock Guardrails is a configurable set of policies that evaluates prompts and model responses and blocks or masks content that breaks your rules. Pick the policy by what it detects:

PolicyDetectsTypical use
Denied topicsA subject, defined by a natural-language description and sample phrases, recognised however it is phrasedNo medical diagnoses, no tax advice
Content filtersHarm categories (hate, insults, sexual, violence, misconduct) at a chosen strength, for prompts and responsesGeneral harmful content
Prompt attack filterJailbreaks, prompt injection and prompt leakage (prompt leakage: Standard tier only) in user inputUsers trying to override instructions
Word filtersExact words and phrases, plus a managed profanity listCompetitor names, banned terms
Sensitive information filtersBuilt-in PII types and custom regex patternsBlock or mask personal data
Contextual grounding checkResponses not grounded in the source or not relevant to the queryRAG hallucination control

Word filters match exact text, so they cannot recognise a topic phrased in a roundabout way, and contextual grounding judges support for an answer, not its subject or its personal data.

Prompt attacks and input tags

When you call InvokeModel with a guardrail, the prompt attack filter evaluates only content wrapped in the guardrail input tags (with the tag suffix given in the request), so that a developer's own system prompt is not flagged. If the user's message is not tagged, jailbreaks pass while other filters still work.

Sensitive information: block, mask, detect

Each PII type or regex has separate actions for inputs and outputs: Block (reject with the configured message), Mask (replace the value with a placeholder such as {EMAIL} and return the rest), or detect only. Block on input stops a prompt before the model sees it; mask on output keeps the answer usable. Company-specific identifiers with a known format need a regex filter.

Guardrails change what the model and the user see, not what is logged. Model invocation logs keep the original input, and masked or blocked content can appear in plain text there and in guardrail trace output. Protect log readers with a CloudWatch Logs data protection policy that masks the identifiers (only principals with logs:Unmask see the originals).

Guardrails outside Bedrock inference

The ApplyGuardrail API evaluates any text against a guardrail without invoking a Bedrock model. For a model that must stay on a SageMaker AI endpoint (or anywhere else), call ApplyGuardrail on the prompt, invoke the model only if it passes, then call it again on the response. Guardrails are a Bedrock feature, so ApplyGuardrail is how a model hosted elsewhere gets them.

How do you enforce guardrails and mitigate risks in agents and FM applications?

Enforce guardrail use in IAM with the bedrock:GuardrailIdentifier condition key, and treat everything a model reads as untrusted: give agent tools least privilege, take identity out of the model's hands, and require confirmation for consequential actions.

Enforcing a guardrail with IAM

  • Allow the inference actions when bedrock:GuardrailIdentifier equals the guardrail ARN with its version (for example …:guardrail/gr7xk2pq:5), and add an explicit Deny when it does not equal that value. The Deny is what refuses calls that name no guardrail or another one, especially when a broad bedrock:* allow must stay.
  • A guardrail ARN without a version refers to the DRAFT version, so it will not match a numbered version.
  • Converse is authorized as bedrock:InvokeModel (and ConverseStream as bedrock:InvokeModelWithResponseStream), so the same statements cover both APIs.
  • AWS documents a limitation: a role that enforces a guardrail this way should not be used for RetrieveAndGenerate, InvokeAgent or InvokeInlineAgent, because those APIs make internal model calls that do not all carry the guardrail identifier and fail. Use a separate role for those workloads and keep the guardrail in their requests.

ML and AI security risks and mitigations

RiskMitigation that holds when the model is manipulated
Indirect prompt injection: instructions hidden in emails, documents or web pages trigger an agent actionUser confirmation on the action group function (the agent must get the end user's approval before calling it), plus a prompt attack filter on tagged user input (it does not evaluate tool results or content the agent retrieves)
Excessive agency: a tool can do far more than the use case needsLeast privilege on the action group's Lambda execution role (only the operations and resources that tool's use case needs)
Broken object-level authorization: the tool trusts a model-chosen ID to decide whose data to returnPass the authenticated user's ID in session attributes and filter on it in the function
Tampering with training data, images or model artifactsLeast-privilege write access, S3 versioning, ECR tag immutability, scanning, and approval in the Model Registry before deployment
Sensitive data leaking through prompts, responses or logsGuardrail sensitive information filters, log data protection, encryption with KMS

Prompt instructions ("ignore commands in emails") and denied topics work on text and can be bypassed, and logging only detects. Confirmation protects against actions the user did not intend; protecting other users' data from the user is an authorization check inside the tool.

Tip. Task 4.3 questions describe an ML pipeline, SageMaker AI job, endpoint, Bedrock application or agent together with a security requirement or a failure, and ask which control, policy, setting or credential meets it. They test when each scanning option runs, how execution roles, iam:PassRole, KMS key policies and resource policies combine, how IAM condition keys and SCPs prevent non-compliant ML resources, what VPC configuration, network isolation and VPC endpoints each do, what CloudTrail, model invocation logging and AWS Config record, which credential type suits an application or tool, and which Bedrock Guardrails policy and enforcement mechanism fits a stated need, including risks specific to agents. Troubleshooting items present an error message or CloudTrail record and ask for the fix. Some items ask for two answers.

Key takeaways
  • Any registry-side image scan runs after the push; a 'never stored' rule needs the Inspector SBOM Generator and Scan API inside the build, and 'keep re-checking old images' needs Inspector continuous enhanced scanning.
  • CodeGuru Reviewer is closed to new repository associations and CodeGuru Security is discontinued; Amazon Inspector code security provides SAST, SCA and IaC scanning for GitHub and GitLab.
  • A SageMaker AI job runs with its execution role; the caller needs iam:PassRole scoped to that role ARN with iam:PassedToService = sagemaker.amazonaws.com.
  • Cross-account or SSE-KMS artifacts need kms:Decrypt in both the key policy and the role's identity policy; cross-account model packages also need a model package group resource policy.
  • Prevent non-compliant jobs with explicit Deny statements on SageMaker AI condition keys, one per requirement; negated operators match a missing key, positive ones need IfExists or a Null check.
  • Network isolation blocks all outbound calls from the container, even inside a VPC, but input channels and output upload still work; a VPC without an S3 endpoint or NAT gives timeouts, not AccessDenied.
  • SageMaker InvokeEndpoint and Bedrock InvokeAgent, Retrieve and ApplyGuardrail are CloudTrail data events (off by default); CloudTrail never records prompts, which need Bedrock model invocation logging.
  • Applications on AWS should use IAM role credentials; short-term Bedrock API keys (at most 12 hours) suit key-only tools, and long-term keys tied to IAM users are for exploration only.
  • Match the guardrail policy to the need: denied topics for subjects, content filters for harm categories, input-tagged prompt attack filters for jailbreaks, sensitive information and regex filters to block or mask PII.
  • Enforce a guardrail with bedrock:GuardrailIdentifier using the versioned ARN and an explicit Deny, and keep that role away from RetrieveAndGenerate and InvokeAgent.

Frequently asked questions

What is the difference between Amazon Inspector enhanced ECR scanning and the Inspector Scan API in CodeBuild?

Inspector enhanced scanning evaluates images after they are stored in Amazon ECR and, with continuous scanning, re-evaluates them automatically when new CVEs affect their packages. The Inspector Scan API, fed an SBOM from the Inspector SBOM Generator inside CodeBuild, scans the image before it is pushed so the build can fail and the image is never stored. Many teams use both.

Why does a SageMaker AI training job get AccessDenied when the engineer can read the S3 bucket?

A SageMaker AI job uses the credentials of its execution role, not the identity of the person who started it. If the execution role lacks s3:GetObject on the input prefix, or kms:Decrypt on the key of an SSE-KMS bucket, the job fails even though the engineer can open the same bucket from a notebook.

What does SageMaker AI network isolation do?

Network isolation (EnableNetworkIsolation) blocks all outbound network calls from the training or inference container, including calls to AWS services and calls made inside a VPC. SageMaker AI still copies input channels into the container and uploads model artifacts, so files the code needs at start-up must be staged in S3 and supplied as an input channel.

Does AWS CloudTrail record SageMaker AI endpoint invocations and Amazon Bedrock prompts?

CloudTrail records SageMaker AI InvokeEndpoint calls only as data events for the AWS::SageMaker::Endpoint resource type, which are off by default and must be added to a trail with an advanced event selector. Bedrock InvokeModel and Converse are management events. CloudTrail never records the prompt or response text; Amazon Bedrock model invocation logging does.

When should I use an Amazon Bedrock API key instead of IAM credentials?

Use IAM role credentials for applications running on AWS, because the SDK obtains and rotates them automatically. Use a short-term Amazon Bedrock API key, which lasts at most 12 hours and inherits the permissions of the principal that generated it, for tools that accept only an API key. Long-term API keys are tied to IAM users and are intended for exploration, not production.

How do you force every Amazon Bedrock call to use a specific guardrail?

Add IAM statements on the inference actions that allow calls when bedrock:GuardrailIdentifier equals the guardrail ARN including its version number, and explicitly deny them when it does not. An ARN without a version means the DRAFT version. Converse is authorized as InvokeModel, so it is covered, but a role enforced this way should not be used for RetrieveAndGenerate or InvokeAgent.

Do Amazon Bedrock Guardrails remove PII from model invocation logs?

No. A guardrail's sensitive information filter can block or mask PII in what the model receives and what the user sees, but model invocation logs keep the original input, so masked values can still appear there. Protect the log group with a CloudWatch Logs data protection policy that masks those identifiers for readers.

How do you stop prompt injection from making a Bedrock agent take unwanted actions?

Turn on user confirmation for consequential action group functions so the agent must get the end user's approval before calling them, give each tool's execution role only the permissions its use case needs, and pass the authenticated user's identity through session attributes instead of trusting identifiers the model extracts. Prompt instructions alone are not a reliable defence.

Source

This lesson covers the "Operating, Monitoring, and Securing ML and AI Solutions" domain of the official MLA-C02 exam guide. Vendors revise their guides — check the source for the current version.

Test yourself on this topic
Practice questions with full explanations.
Practice now

Sign up free to mark lessons complete, bookmark topics and track your exam readiness.

Spotted a mistake in this lesson?