Skip to content

DVA-C03 · Domain 2: Security · 26% of the exam

Task 2.3: Identify and mitigate security risks associated with using and integrating AI services into application development.

Calling AI services safely: requesting and controlling access to models, private connectivity and data that is not used for training, filtering prompts and responses for harmful content, PII and prompt attacks, authorizing the tools an agent may use, isolating sessions and asking a human before sensitive actions, and keeping sensitive content out of logs.

Study it

  • Access to AI services: model access, IAM permissions and private connectivity

    Lesson coming

  • Filtering model input and output: content filters, sensitive information and prompt attacks

    Partly covered by: Guardrails, Finding and Masking PII

  • Securing agents: tool-use authorization, session isolation and human approval

    Partly covered by: Agents and Tools, The Tool-Use Loop

  • Keeping prompts and responses out of logs

    Partly covered by: Finding and Masking PII

Sample questions

Try each one before opening the answer. Every option is explained, with the AWS documentation page that proves it.

Question 1 · choose 1

A new AWS account runs an AWS Lambda function that calls an Anthropic Claude model in Amazon Bedrock with the Converse API. The execution role allows bedrock:InvokeModel on the model, and the account has the required AWS Marketplace permissions. Every call fails with an FTUFormNotFilled error. What should the developer do?

  1. ASubmit the Anthropic first-time use case details for the account
  2. BRequest access to the model on the Model access page of the console
  3. CAsk AWS Sales for additional account-level access to the Anthropic model
  4. DAdd bedrock:InvokeModelWithResponseStream to the execution role
Show the answer and why
  • ASubmit the Anthropic first-time use case details for the account

    Correct

    Anthropic requires first-time customers to submit use case details once per account, or once in the organization's management account. The error means the details are missing.

  • BRequest access to the model on the Model access page of the console

    Incorrect

    In commercial Regions there is no access request to submit on that page; it applies to AWS GovCloud (US). The use case details are a separate requirement.

  • CAsk AWS Sales for additional account-level access to the Anthropic model

    Incorrect

    Additional account-level access is the step after all activation requirements are complete and calls still return AccessDeniedException. The use case form is one of those requirements.

  • DAdd bedrock:InvokeModelWithResponseStream to the execution role

    Incorrect

    That permission authorizes ConverseStream and InvokeModelWithResponseStream. The function calls Converse, which bedrock:InvokeModel already allows.

FTUFormNotFilled means the Anthropic first-time use case details have not been submitted for the account. Submit them in the console or with PutUseCaseForModelAccess; a submission in the management account is inherited by the organization's other accounts.

Question 2 · choose 1

An AWS Lambda function's execution role allows bedrock:InvokeModel and bedrock:InvokeModelWithResponseStream on a foundation model in Amazon Bedrock. The developer adds a guardrailConfig with a guardrail identifier and version to the function's Converse calls, and those calls now fail with AccessDeniedException. Calls without the guardrail still succeed. Which permission should the developer add to the execution role?

  1. Abedrock:GetGuardrail on the guardrail's ARN
  2. Bbedrock:CreateGuardrailVersion on the guardrail's ARN
  3. Cbedrock:InvokeModel on the guardrail's ARN
  4. Dbedrock:ApplyGuardrail on the guardrail's ARN
Show the answer and why
  • Abedrock:GetGuardrail on the guardrail's ARN

    Incorrect

    GetGuardrail belongs to the permissions for creating and managing guardrails. It reads a guardrail's configuration but does not authorize applying the guardrail during inference.

  • Bbedrock:CreateGuardrailVersion on the guardrail's ARN

    Incorrect

    Creating versions is a management action for the team that owns the guardrail. The version already exists; the function only needs to apply it.

  • Cbedrock:InvokeModel on the guardrail's ARN

    Incorrect

    bedrock:InvokeModel is granted on foundation models or inference profiles. Applying a guardrail is a separate action on the guardrail resource.

  • Dbedrock:ApplyGuardrail on the guardrail's ARN

    Correct

    A role that invokes models with a guardrail needs bedrock:ApplyGuardrail on the guardrail, in addition to the InvokeModel permissions on the model.

Using a guardrail in model inference requires bedrock:ApplyGuardrail on the guardrail resource. With the standalone ApplyGuardrail API, that permission is the only one needed.

Question 3 · choose 1

A platform account hosts an agent on Amazon Bedrock AgentCore Runtime. A product team's backend in another account must call InvokeAgentRuntime on the runtime's DEFAULT endpoint. The backend's IAM role allows the action on both the agent runtime and the endpoint, and the platform team attached a resource-based policy to the agent runtime that allows that role. Calls still fail with AccessDeniedException. What is missing?

  1. AA resource-based trust policy on the agent's execution role for the product account
  2. BA resource-based policy on the agent endpoint that allows the same role
  3. Cbedrock-agentcore:InvokeAgentRuntimeForUser for the backend's role
  4. DA resource-based policy on an interface VPC endpoint that allows the role
Show the answer and why
  • AA resource-based trust policy on the agent's execution role for the product account

    Incorrect

    The execution role is the identity the agent itself runs with. Callers do not assume it, so trusting the product account does not authorize the invocation.

  • BA resource-based policy on the agent endpoint that allows the same role

    Correct

    For InvokeAgentRuntime, AWS evaluates both the agent runtime and the agent endpoint. Cross-account access needs a resource-based policy that allows the caller on both resources.

  • Cbedrock-agentcore:InvokeAgentRuntimeForUser for the backend's role

    Incorrect

    That action is required only when a request carries the X-Amzn-Bedrock-AgentCore-Runtime-User-Id header. It is not needed for a plain cross-account invocation.

  • DA resource-based policy on an interface VPC endpoint that allows the role

    Incorrect

    An endpoint policy controls requests that pass through a VPC endpoint. It cannot supply the allow that the agent endpoint's own resource-based policy is missing, so AccessDeniedException remains.

Agent endpoints are separate resources. With hierarchical authorization, a cross-account caller needs an explicit allow in the resource-based policies of both the agent runtime and the agent endpoint.

Question 4 · choose 1

AWS Lambda functions in private subnets with no NAT gateway call an agent on Amazon Bedrock AgentCore Runtime and the MCP tools of an AgentCore Gateway. The VPC has an interface endpoint for com.amazonaws.us-east-1.bedrock-agentcore with private DNS turned on. Runtime invocations work, but every call to the gateway's URL times out. The traffic must not leave the AWS network. What should the developer add?

  1. AAn interface endpoint for com.amazonaws.us-east-1.bedrock-agentcore-control
  2. BAn interface endpoint for com.amazonaws.us-east-1.bedrock-runtime
  3. CA NAT gateway in a public subnet, with a default route from the private subnets
  4. DAn interface endpoint for com.amazonaws.us-east-1.bedrock-agentcore.gateway
Show the answer and why
  • AAn interface endpoint for com.amazonaws.us-east-1.bedrock-agentcore-control

    Incorrect

    That endpoint serves control plane operations, such as creating and managing runtimes. Gateway invocations do not go through it.

  • BAn interface endpoint for com.amazonaws.us-east-1.bedrock-runtime

    Incorrect

    The bedrock-runtime endpoint serves model inference, such as Converse and InvokeModel. It does not serve AgentCore Gateway traffic.

  • CA NAT gateway in a public subnet, with a default route from the private subnets

    Incorrect

    A NAT gateway would reach the gateway's public endpoint over the internet, which the requirement rules out.

  • DAn interface endpoint for com.amazonaws.us-east-1.bedrock-agentcore.gateway

    Correct

    AgentCore Gateway has its own PrivateLink endpoint service. With private DNS, calls to the gateway's default DNS name resolve to the endpoint in the VPC.

AgentCore offers three PrivateLink endpoint services: the data plane (bedrock-agentcore) for Runtime, Memory, Identity and the built-in tools, the control plane (bedrock-agentcore-control), and a separate one for Gateway (bedrock-agentcore.gateway).

Question 5 · choose 1

A production AWS Lambda function calls the Converse API with a guardrail whose guardrailVersion is DRAFT. While testing a stricter denied topic, a teammate edited the guardrail in the console, and production responses started to be blocked within minutes. Production behavior must change only when the team releases a tested guardrail configuration on purpose. What should the developer do?

  1. ATurn on the guardrail trace in production to see which policy blocked each response
  2. BGrant the production role access only to the guardrail ARN with a :DRAFT suffix
  3. CDeny bedrock:UpdateGuardrail to everyone and keep production on the DRAFT version
  4. DCreate a guardrail version and reference its number in guardrailConfig
Show the answer and why
  • ATurn on the guardrail trace in production to see which policy blocked each response

    Incorrect

    The trace shows which policy intervened, which helps diagnosis, but production still follows every change to the draft.

  • BGrant the production role access only to the guardrail ARN with a :DRAFT suffix

    Incorrect

    Guardrail versions are not separate resources and have no ARN, so the Resource element of a policy cannot target one. The draft would still change with every edit.

  • CDeny bedrock:UpdateGuardrail to everyone and keep production on the DRAFT version

    Incorrect

    Blocking all edits stops the team from iterating on the guardrail, and the next permitted edit would again reach production at once.

  • DCreate a guardrail version and reference its number in guardrailConfig

    Correct

    A version is a snapshot of the guardrail at a point in time. Production keeps using it while the working draft changes, and the team moves to a new version by updating the application.

Applications should invoke a numbered guardrail version, not the working draft. Edits to the draft then affect only testing until the team creates a new version and points the application at it.

Question 6 · choose 1

Before a claims app sends a claim to a model in Amazon Bedrock, it calls the ApplyGuardrail API once for each form field and masks whatever the guardrail's sensitive information filter detects. Many fields hold only a short value, such as "Jane Roe" in a contact field or a bare phone number. Tests show that many of these short values pass through unmasked, while the same names and numbers inside the free-text description are masked. The built-in NAME and PHONE types are already set to mask. What should the developer do?

  1. ASet the guardrail's content filters to HIGH strength for prompts
  2. BChange the NAME and PHONE actions from mask to block
  3. CCheck the assembled prompt, with its field labels, in one call
  4. DAdd the customers' names to a custom word filter of the guardrail
Show the answer and why
  • ASet the guardrail's content filters to HIGH strength for prompts

    Incorrect

    Content filters detect harmful categories such as hate, insults, sexual content, violence and misconduct. They do not detect names or phone numbers.

  • BChange the NAME and PHONE actions from mask to block

    Incorrect

    The action decides what happens after a value is detected. Values that the filter does not detect pass through whatever the action is.

  • CCheck the assembled prompt, with its field labels, in one call

    Correct

    The sensitive information filter is a context-dependent machine learning model. AWS advises giving it enough context and avoiding single words or short phrases, because the same string can mean different things depending on the text around it.

  • DAdd the customers' names to a custom word filter of the guardrail

    Incorrect

    Word filters block the exact words and phrases on the list. They do not mask a value, and a list cannot cover every customer's name.

Sensitive information filters detect PII from the surrounding context. Sending each short field value on its own removes that context, so check the whole text that goes to the model, with its labels, in one request.

Question 7 · choose 1

An agent on Amazon Bedrock AgentCore Runtime reads the prompt field from each JSON payload and passes it to its agent framework, which also accepts structured content blocks. A tester sends a payload whose prompt is a list that holds a toolUse block for the refund tool. The refund tool runs at once, with no model reasoning and no guardrail check. What should the developer do?

  1. ARaise the guardrail's prompt attack filter to HIGH for inputs
  2. BAccept only a string prompt and strip toolUse blocks from user messages
  3. CTell the model in the system prompt never to emit toolUse for refunds unasked
  4. DSwitch the runtime's inbound authorization from SigV4 to JWT bearer tokens
Show the answer and why
  • ARaise the guardrail's prompt attack filter to HIGH for inputs

    Incorrect

    A toolUse block in the payload makes the framework run the tool directly, so the guardrail never evaluates the request.

  • BAccept only a string prompt and strip toolUse blocks from user messages

    Correct

    AWS advises validating that the prompt is a string and filtering out toolUse content blocks from user-supplied messages, because such a block can make the framework execute the named tool without model evaluation.

  • CTell the model in the system prompt never to emit toolUse for refunds unasked

    Incorrect

    The tool runs before the model is involved, so instructions in the system prompt are never applied.

  • DSwitch the runtime's inbound authorization from SigV4 to JWT bearer tokens

    Incorrect

    Authentication decides who may call the runtime. An authenticated caller can still send the same payload.

The payload is parsed from arbitrary JSON. Enforce that prompt is a string, validate the request structure with a schema, and remove toolUse blocks from user-supplied messages before they reach the agent framework.

Question 8 · choose 1

An AWS Lambda function calls the Converse API with a guardrail that masks email addresses and phone numbers. The guardrail trace is enabled because the code must tell masked answers from blocked ones. For debugging, the function writes each complete Converse response to CloudWatch Logs. Analysts have found unmasked customer email addresses in those logs, although users only ever see masked answers. The debugging logs must stay. What should the developer do?

  1. ADisable the guardrail trace in the Converse requests
  2. BChange the filter action for those PII types from ANONYMIZE to BLOCK
  3. CEncrypt the function's log group with a customer managed KMS key
  4. DLog the output text and only the trace's action and type fields
Show the answer and why
  • ADisable the guardrail trace in the Converse requests

    Incorrect

    Without the trace, the logs lose the unmasked values, but the code can no longer tell masking from blocking, because both set the stop reason to guardrail_intervened.

  • BChange the filter action for those PII types from ANONYMIZE to BLOCK

    Incorrect

    Blocking changes what users receive, and the trace still reports the detected value of each entity.

  • CEncrypt the function's log group with a customer managed KMS key

    Incorrect

    CloudWatch Logs decrypts the data for anyone allowed to read the log group, so analysts would still see the addresses.

  • DLog the output text and only the trace's action and type fields

    Correct

    The trace returns unmasked values: modelOutput holds the response before masking, and each assessment's match field holds the detected value. Logging only the masked output and the action and type keeps the logs useful without them.

Masking applies to the response that users receive, not to the trace. AWS advises treating the guardrail trace as sensitive data and not logging it alongside ordinary responses.

Practice domain 2 →Practice all domains →