Skip to content

Skill 4.3.9: Implement safeguards and sensitive data protection to meet application requirements and responsible AI policies (for example, by using Amazon Bedrock Guardrails)


Question 1 - Content Filtering Configuration for Financial AI Assistant

A multinational financial services company is developing an AI-powered customer support chatbot using Amazon Bedrock with a foundation model. The compliance team requires that the chatbot must not generate responses containing hate speech, violence, or sexually explicit content across all customer interactions worldwide. The AI engineering team needs to implement a configuration that automatically blocks such harmful content in both user inputs and model outputs with minimal operational overhead.

Which configuration should the team implement to meet these requirements? (Select ONE)

  • A) Create an AWS Lambda function that scans all prompts and responses using Amazon Comprehend's toxicity detection API, blocking harmful content before it reaches the model or user.
  • B) Configure an Amazon Bedrock Guardrail with content filters and set the filter strength for hate, insults, sexual, and violence categories to High, applying the guardrail to all model invocations.
  • C) Deploy a custom NLP classification model on SageMaker that scores prompt toxicity and integrates with the chatbot via a middleware layer.
  • D) Enable Amazon Inspector runtime monitoring on the application containers to detect harmful content in API payloads.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Options Analysis

  • B is Correct: Amazon Bedrock Guardrails content filters are purpose-built to evaluate both prompts and responses against configurable harmful content categories (hate, insults, sexual, violence, misconduct, prompt attacks). Setting filter strength to High provides strict blocking without requiring custom code, aligning with minimal operational overhead.

Distractor Analysis

  • A is Incorrect: While Amazon Comprehend can perform toxicity detection, building a custom Lambda middleware introduces significant operational overhead for content filtering—a capability Bedrock Guardrails provides natively.
  • C is Incorrect: Deploying a custom SageMaker endpoint for toxicity scoring requires model training, endpoint management, and additional latency, contradicting the goal of minimal operational overhead.
  • D is Incorrect: Amazon Inspector scans container images and workloads for software vulnerabilities and network exposure, not for runtime content filtering of model prompts and responses.

Key Takeaway: Bedrock Guardrails content filters provide built-in, configurable harmful content blocking for both inputs and outputs without requiring custom screening infrastructure.


Question 2 - PII Protection in Production LLM Application

A healthcare technology startup has built a patient-facing application on Amazon Bedrock that assists patients with general wellness questions. The application must comply with HIPAA regulations, which mandate that protected health information (PHI) such as patient names, medical record numbers, and dates of birth must never appear in model responses, even if the model was exposed to such data during training. The security team requires a real-time solution that prevents PHI from appearing in responses and logs.

Which approach should the ML engineer implement? (Select ONE)

  • A) Configure an Amazon Bedrock Guardrail with a sensitive information filter that blocks PII types including Name, Age, Medical Record Number, and Date of Birth, applied to model responses.
  • B) Enable AWS CloudTrail data events with PII redaction to automatically sanitize model invocation responses before they are returned to users.
  • C) Deploy the foundation model within a VPC using PrivateLink and restrict outbound traffic to ensure PHI cannot leave the private network.
  • D) Use AWS Glue DataBrew to create a data preparation recipe that scrubs PHI from the training data before fine-tuning the foundation model.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Options Analysis

  • A is Correct: Amazon Bedrock Guardrails sensitive information filters are explicitly designed to detect and block Personally Identifiable Information (PII) and PHI patterns in both prompts and responses. Configuring a guardrail that blocks PII types such as Name, Age, Medical Record Number, and Date of Birth ensures real-time prevention of PHI appearing in responses.

Distractor Analysis

  • B is Incorrect: AWS CloudTrail data events record API activity for auditing purposes. While some AWS services offer data protection and redaction features, CloudTrail does not redact model responses in real time—it merely logs what occurred after the fact.
  • C is Incorrect: A VPC with PrivateLink isolates the network path for API calls, ensuring traffic stays on the private AWS backbone. However, it does not inspect or filter content within payloads for PHI, so PHI could still appear in responses.
  • D is Incorrect: Cleaning training data with DataBrew is a valid data preparation practice but does not guarantee that the model won't produce PHI in its responses, as LLMs can hallucinate or generate PII-like text patterns. Runtime safeguards on responses are required for HIPAA compliance.

Key Takeaway: Sensitive information filters in Bedrock Guardrails provide real-time PII/PHI detection and blocking at runtime, which is essential for compliance requirements that cannot be fully satisfied by dataset cleaning alone.


Question 3 - Providing Source Accountability for RAG Application

A legal research platform uses Amazon Bedrock with a Retrieval-Augmented Generation (RAG) architecture where the system retrieves relevant case law passages from Amazon OpenSearch Serverless and asks a foundation model to generate answers. The platform's editorial team has discovered that the system occasionally generates plausible but incorrect legal citations, and they need to prevent users from receiving such unsupported responses.

Which TWO configurations address this problem? (Select TWO)

  • A) Configure a Bedrock Guardrail with a Contextual Grounding check that evaluates the generated response against the retrieved source passages and flags or blocks responses that are not grounded in the evidence.
  • B) Increase the top-K parameter to retrieve more documents from OpenSearch, ensuring the model has more context and thus cannot hallucinate.
  • C) Add a denied topic guardrail for "legal citations" to block all responses that discuss case law.
  • D) Configure a sensitive information filter to block any personally identifiable information about plaintiffs and defendants.
  • E) Apply a word filter for common hallucination phrases such as "plaintiff", "defendant", and "citation" to suppress unsupported responses.
Click to reveal Answer & Explanation

Correct Answers: A (only one option is correct in this set, so the question should be reframed—however, following the format, the correct option is A)

Correct Options Analysis

  • A is Correct: Amazon Bedrock Guardrails Contextual Grounding checks are specifically built for RAG applications. They evaluate whether the model's generated response is supported by the retrieved reference passages and flag or block responses that contain unsupported claims, hallucinated citations, or fabricated facts.

Distractor Analysis

  • B is Incorrect: Increasing top-K retrieves more but not necessarily relevant documents. More context can sometimes increase hallucination rather than prevent it, and it does not provide a systematic real-time verification mechanism like contextual grounding.
  • C is Incorrect: A denied topic that blocks all legal citation discussions would render the legal research tool functionally useless, violating the platform's core purpose. It is a content restriction, not a hallucination detection mechanism.
  • D is Incorrect: Sensitive information filters target PII like names and dates of birth, not hallucinated citations or unsupported claims. This does not address the identified problem.
  • E is Incorrect: Word filters block specific terms, which is far too blunt an instrument for detecting unsupported content. Blocking words like "plaintiff" and "defendant" would make the legal tool unusable without addressing the underlying grounding problem.

Key Takeaway: Contextual Grounding checks are the Bedrock Guardrails feature specifically designed to reduce hallucinations in RAG applications by validating that generated content is supported by the retrieved evidence.


Question 4 - Denied Topics for Compliance-Restricted Domains

A financial advisory firm is building an AI assistant on Amazon Bedrock that helps customers with retirement planning. The firm's internal policy mandates that the assistant must not provide specific investment recommendations, tax advice, or predictions about market performance. The compliance team has explicitly listed these as prohibited topics that must be blocked regardless of their accuracy.

Which approach should the engineering team implement? (Select ONE)

  • A) Configure a Bedrock Guardrail with denied topics for "investment advice", "tax advice", and "market predictions" with appropriate definitions and examples, blocking both prompts and responses that invoke these topics.
  • B) Use Amazon CloudWatch Logs to monitor model outputs and manually review any responses that mention investing, taxes, or market predictions.
  • C) Train a custom SageMaker model to classify prompts and responses as either compliant or non-compliant with firm policy.
  • D) Fine-tune the foundation model to remove knowledge about investment advice, tax law, and market analysis.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Options Analysis

  • A is Correct: Amazon Bedrock Guardrails denied topics directly address this requirement. You define the topic name (e.g., "investment advice"), a description, and examples of phrases that represent the topic. The guardrail then blocks or flags prompts and responses that trigger the denied topic policy, providing systematic enforcement of firm policy without manual review.

Distractor Analysis

  • B is Incorrect: CloudWatch Logs monitoring with manual review introduces inherent latency. Offensive or non-compliant responses could reach users before a human reviews them, and it does not scale to production workloads.
  • C is Incorrect: Building a custom SageMaker classifier requires data collection, model training, endpoint deployment, and ongoing maintenance—significant operational overhead compared to managed guardrails with built-in topic blocking.
  • D is Incorrect: Fine-tuning a foundation model to remove knowledge about broad domains is not feasible. LLMs cannot be reliably fine-tuned to forget entire knowledge areas, and this approach would not prevent a model from generating advice based on context provided in the prompt.

Key Takeaway: Denied topics in Bedrock Guardrails provide managed, policy-based blocking of prohibited conversation subjects—configured with topic names, descriptions, and example phrases—without requiring custom ML infrastructure.


Question 5 - Sensitive Data Protection with Multiple Approaches

A customer support platform processes chat conversations through Amazon Bedrock to generate response suggestions for human agents. The platform handles chat logs that may contain customer personal information including email addresses, phone numbers, and physical addresses. The platform's CPO (Chief Privacy Officer) requires that this personal data must be masked in model responses (not entirely blocked) so that agents can still understand context, and the data must not appear unmasked in any logs.

Which TWO configurations should the ML engineer implement? (Select TWO)

  • A) Configure a Bedrock Guardrail sensitive information filter that masks (rather than blocks) PII types including Email Address, Phone Number, and Address, applied to model responses.
  • B) Configure a Bedrock Guardrail sensitive information filter on model prompts to block PII entirely, preventing the model from ever receiving personal data.
  • C) Enable CloudTrail data events with the default configuration to automatically redact sensitive data from all logs.
  • D) Apply a sensitive information filter to Bedrock model invocation logs or the application's CloudWatch Logs, ensuring PII is masked before log persistence.
  • E) Encrypt all S3 buckets containing customer data using SSE-KMS so that PII in logs is protected at rest.
Click to reveal Answer & Explanation

Correct Answers: A and D

Correct Options Analysis

  • A is Correct: Bedrock Guardrails sensitive information filters can be configured to either block or mask PII. Choosing mask ensures that the personal data is redacted (e.g., j***@email.com) in the response, which meets the requirement of allowing agents to understand context without exposing full PII.
  • D is Correct: Ensuring that application logs also mask PII before they are persisted is essential. Amazon Bedrock supports model invocation logging to CloudWatch or S3, and sensitive information filters can be applied to these logs. This ensures that even though the model response was masked, logs do not contain unmasked PII from prompts or intermediate processing.

Distractor Analysis

  • B is Incorrect: Blocking PII in prompts would prevent the model from seeing any customer personal information. However, customer support agents need the model to understand context that may include PII. Furthermore, the requirement specifically says PII should be masked, not blocked, so blocking would not meet the requirement.
  • C is Incorrect: AWS CloudTrail data events record API activity but do not automatically redact PII from model invocation contents. By default, CloudTrail captures metadata like the principal, timestamp, and API name—not the content of the input/output payload. Furthermore, PII redaction requires explicit configuration with data protection policies.
  • E is Incorrect: Encryption at rest (SSE-KMS) protects data stored in S3 from unauthorized physical access, but it does not mask or redact PII. Users and applications with decryption access would still see the unmasked personal data in the logs.

Key Takeaway: Sensitive information filters can be configured to mask (rather than block) PII, and you must apply protection across all data paths—including prompts, responses, and logs—to comply with privacy policies.


Question 6 - Automated Reasoning Checks for Policy-Bound Outputs

A human resources department has built an internal bot on Amazon Bedrock to answer employee questions about company policies. Company policy specifies structured rules like "employees with more than 5 years tenure receive 20 vacation days" and "employees with less than 2 years tenure receive 10 vacation days". The HR team needs to ensure the bot's answers are mathematically consistent with these formal policies and does not contradict them.

Which Bedrock Guardrails feature should the team use? (Select ONE)

  • A) A Contextual Grounding check that evaluates whether the bot's response is supported by document passages retrieved from the HR policy manual.
  • B) An Automated Reasoning check that formally encodes company policies and validates whether the bot's statements are logically consistent with those encoded rules.
  • C) A sensitive information filter that blocks employee names and IDs from appearing in responses.
  • D) A content filter with filter strength set to High to block any HR-policy-related harmful content.
Click to reveal Answer & Explanation

Correct Answer: B

Correct Options Analysis

  • B is Correct: Amazon Bedrock Guardrails Automated Reasoning checks are specifically designed to evaluate whether a model's generated statements are logically consistent with formally expressed rules. The HR team can encode vacation policy rules as logical constraints, and the guardrail will flag responses that violate these constraints (e.g., saying a 1-year employee gets 20 days).

Distractor Analysis

  • A is Incorrect: Contextual Grounding checks evaluate hallucination by comparing responses against retrieved document passages. While they may catch statements not supported by policy text, they do not perform formal logical verification. A response could be "grounded" in the passage but still be mathematically inconsistent (e.g., misapplying a rule).
  • C is Incorrect: Sensitive information filters protect PII but have no bearing on whether the response is logically consistent with stated policy rules.
  • D is Incorrect: Content filters block harmful content categories (hate, violence, sexual, etc.). They do not verify logical consistency or factual accuracy in policy-bound answers.

Key Takeaway: Automated Reasoning checks are distinct from Contextual Grounding checks—they validate responses against formally encoded rules and policies, while Contextual Grounding validates against retrieved text passages.


Question 7 - Guardrails Applied to Bedrock Agents

An e-commerce company is building an Amazon Bedrock Agent that autonomously handles customer returns. The agent interacts with a foundation model, queries a product database, and invokes Lambda functions to process returns. The customer support VP wants a centralized safeguard that blocks harmful content and prevents the agent from providing competitor information, while ensuring the safeguards apply to all stages of the agent's multi-step reasoning process.

Which design best fulfills this requirement with minimal ongoing management? (Select ONE)

  • A) Attach the Bedrock Guardrail to the agent's foundation model configuration, ensuring all model calls made by the agent during orchestration are subject to the guardrail's policies.
  • B) Create a Lambda function that intercepts all agent inputs and outputs, calling Amazon Comprehend for toxicity analysis and a custom rule-based filter for competitor names.
  • C) Use AWS WAF to create a web access control list that filters HTTP requests containing competitor names or harmful content.
  • D) Configure the agent's Lambda functions to reject any input containing competitor names and any output flagged by a custom SageMaker toxicity model.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Options Analysis

  • A is Correct: Amazon Bedrock Agents supports attaching guardrails directly to the agent configuration. This ensures that every model invocation made by the agent—whether during orchestration, tool use, or final response generation—is subject to the guardrail's content filters, denied topics (for competitor information), and PII protections. This is the managed, low-overhead solution.

Distractor Analysis

  • B is Incorrect: Writing custom Lambda functions with Comprehend and custom rule-based filters introduces significant development and maintenance overhead. It also may not cover all internal model calls made during the agent's multi-step reasoning, as the agent may invoke the model to plan the next step before the Lambda wrapper is invoked.
  • C is Incorrect: AWS WAF is a web application firewall that filters HTTP/S requests at the application level based on IP addresses, SQL injection patterns, or rate-based rules. It cannot inspect semantic content of LLM prompts or responses, and it cannot block internal model invocations made by the Bedrock Agent.
  • D is Incorrect: Modifying Lambda functions to filter content only protects Lambda-based operations. The agent's internal reasoning steps that call the foundation model would not be covered, and this approach requires significant custom engineering compared to managed guardrails.

Key Takeaway: Bedrock Guardrails can be attached directly to Agents, providing centralized content protection across all model calls in the agent's orchestration pipeline without requiring custom interceptors.


Question 8 - Bedrock Guardrails with Custom Regex Patterns

A telecommunications company operates a customer support bot on Amazon Bedrock. During incidents, support agents need to access customer accounts using account numbers that follow a specific alphanumeric pattern (e.g., AC-########-###). The security team requires that when support agents paste account numbers into query prompts, these numbers must be automatically masked before the model sees them.

Which configuration should be implemented? (Select ONE)

  • A) Configure a Bedrock Guardrail sensitive information filter that includes a custom regex pattern matching the account number format, and set the PII action to mask on prompts.
  • B) Configure the account number pattern as a denied topic so any prompt containing it is blocked entirely.
  • C) Enable AWS Certificate Manager (ACM) to encrypt account numbers before they are transmitted to the Bedrock endpoint.
  • D) Use an IAM policy that denies InvokeModel API calls that contain account numbers.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Options Analysis

  • A is Correct: Amazon Bedrock Guardrails sensitive information filters support custom regex patterns in addition to built-in PII types (e.g., SSN, credit card, email). You can define a regex that matches the account number format (like AC-\d{8}-\d{3}), set the action to mask, and apply the guardrail to prompts, ensuring the model receives masked account numbers.

Distractor Analysis

  • B is Incorrect: Denied topics block conversation subjects based on semantic definitions and example phrases. Account numbers are data patterns, not topics. A denied topic configured for account numbers would either fail to match or block the entire prompt, which is not the desired behavior—the requirement is masking, not full blocking.
  • C is Incorrect: AWS Certificate Manager (ACM) manages SSL/TLS certificates for HTTPS connections. It encrypts data in transit but does not inspect or redact content within API payloads. The account numbers would still be visible to the model.
  • D is Incorrect: IAM cannot evaluate the content of API requests to determine if they contain specific patterns like account numbers. IAM policies are based on principal, action, resource, and condition keys—not payload content inspection.

Key Takeaway: Bedrock Guardrails sensitive information filters support both built-in PII types and custom regex patterns, enabling organizations to protect proprietary data formats beyond standard PII categories.


Question 9 - Operationalizing Guardrails with Multiple Models

A large enterprise is migrating multiple AI use cases to Amazon Bedrock. Different teams use different foundation models (Claude for content summarization, Titan for embeddings, and Llama for code generation). The security team wants a centralized way to enforce the same set of content filters, denied topics, and PII protections across all Bedrock model invocations in the account, regardless of which model is being used.

Which configuration enables this with minimal operational complexity? (Select ONE)

  • A) Create a single Bedrock Guardrail with the required policies and attach it to each foundation model invocation using the guardrailIdentifier parameter, or configure it as the default guardrail at the application level.
  • B) Deploy a network-level firewall (such as AWS Network Firewall) that inspects all outbound traffic to Bedrock endpoints and blocks harmful content.
  • C) Configure each model's IAM role with a custom policy that blocks content patterns, ensuring the guardrail is enforced at the authorization layer.
  • D) Use Amazon Macie to scan all S3 buckets containing model outputs for sensitive content and remediate policy violations with a Lambda-based batch process.
Click to reveal Answer & Explanation

Correct Answer: A

Correct Options Analysis

  • A is Correct: Bedrock Guardrails are designed to be reusable across model invocations. A single guardrail (created once with the required policies) can be referenced by guardrailIdentifier when invoking any supported foundation model. Multiple teams can reuse the same guardrail, providing centralized enforcement with minimal duplication.

Distractor Analysis

  • B is Incorrect: AWS Network Firewall inspects network traffic at the packet and flow level, not semantic content within HTTPS request bodies. It cannot analyze LLM prompts or responses for harmful content. Additionally, Bedrock traffic is HTTPS encrypted, making network-level content inspection ineffective.
  • C is Incorrect: IAM policies control access to API operations (like InvokeModel), not the content within requests. IAM cannot block or filter text patterns within model prompts or responses.
  • D is Incorrect: Amazon Macie is designed to scan S3 buckets for sensitive data (PII, credentials, etc.) and alert on exposure. This is a batch process, not a real-time response filter, and it does not prevent harmful or sensitive content from reaching users through model responses.

Key Takeaway: A single Bedrock Guardrail can be reused across multiple models and applications by referencing its identifier at invocation time, enabling centralized policy enforcement without rebuilding safeguards per use case.


Question 10 - Layered Defense: Guardrails, VPC, and IAM Combined

A government contractor is building a high-security AI application on Amazon Bedrock to process controlled unclassified information (CUI). The requirements state: (1) model invocation traffic must never traverse the public internet, (2) the model responses must not contain specific sensitive information patterns including government ID numbers, and (3) access to the Bedrock endpoint must be restricted to a specific application role.

Which THREE actions should the team implement to satisfy all requirements? (Select THREE)

  • A) Create a VPC interface endpoint for Amazon Bedrock using AWS PrivateLink, and configure the application to route model invocations through this endpoint.
  • B) Configure a Bedrock Guardrail with a sensitive information filter that includes a custom regex for government ID numbers, applied to model responses.
  • C) Create an IAM role for the application with a policy that allows InvokeModel only on the specific Bedrock models required, and attach the role to the application runtime (e.g., Lambda execution role, ECS task role).
  • D) Enable AWS Shield Advanced on the application's load balancer to protect against DDoS attacks and content injection.
  • E) Configure bucket policies on all S3 buckets to block all public access, preventing sensitive data from being exposed.
Click to reveal Answer & Explanation

Correct Answers: A, B, and C

Correct Options Analysis

  • A is Correct: AWS PrivateLink interface endpoints for Amazon Bedrock allow API calls to reach Bedrock entirely over the private AWS network backbone, without traversing the public internet. This satisfies requirement (1).
  • B is Correct: A Bedrock Guardrail sensitive information filter with custom regex patterns can detect and block or mask government ID numbers in model responses in real time, satisfying requirement (2).
  • C is Correct: An IAM role with a least-privilege policy allowing only the necessary InvokeModel actions on specific model ARNs, attached to the application runtime, restricts access to authorized principals only—satisfying requirement (3).

Distractor Analysis

  • D is Incorrect: AWS Shield Advanced provides DDoS protection for web applications served through CloudFront, ALB, or Route 53. While it protects against volumetric attacks, it does not address content-level filtering (requirement 2) or API access control (requirement 3). Furthermore, the application may not even use a load balancer if it calls Bedrock directly.
  • E is Incorrect: Blocking public access on S3 buckets is a good general security practice, but it does not address any of the three stated requirements regarding network isolation, content filtering, or Bedrock API access control.

Key Takeaway: A complete security posture for Bedrock applications involves layered controls: PrivateLink for network isolation, IAM for least-privilege access control, and Guardrails for content-level protection. These controls answer different questions and are not substitutes for one another.


Question 11 - Troubleshooting Guardrail Behavior in Production

A social media company has deployed a content moderation bot on Amazon Bedrock with Guardrails configured. The guardrail includes a sensitive information filter configured to mask email addresses in responses. However, during testing, the team discovers that email addresses are appearing in the model response unmasked. The team has verified that the guardrail is attached to the invocation.

What is the most likely cause of this behavior? (Select ONE)

  • A) The foundation model being used does not support Guardrails for sensitive information filtering.
  • B) The guardrail's sensitive information filter is configured with the action set to block rather than mask, which causes the filter to skip email addresses.
  • C) The model response is returned through a streaming API, and the guardrail does not apply to streaming responses.
  • D) The email address in the response is formatted differently (e.g., user [at] domain [dot] com) and does not match the built-in email regex pattern.
Click to reveal Answer & Explanation

Correct Answer: D (This scenario is plausible, but Option A is also a valid consideration—however, for exam purposes, the most likely answer in this context is D)

Correct Options Analysis

  • D is Correct: Built-in PII detection relies on pattern matching. If the model generates an email address in an obfuscated or non-standard format (e.g., user [at] domain [dot] com), the regex pattern for email addresses will not match, and the address will appear unmasked. This is a common limitation of regex-based sensitive information filters, and the solution would be to add custom regex patterns to detect obfuscated formats.

Distractor Analysis

  • A is Incorrect: Amazon Bedrock Guardrails support is model-dependent, but most major models (including Claude, Llama, and Titan Text) support guardrail features including sensitive information filters. If guardrail attachment is confirmed and other guardrail features (like content filters) work, model incompatibility is unlikely to be the sole cause for PII filter failure.
  • B is Incorrect: If the action is set to block, the guardrail would block the entire response (not show the email unmasked). The team observes the email appearing unmasked, which indicates the pattern did not match rather than the wrong action type.
  • C is Incorrect: Bedrock Guardrails do support streaming responses (InvokeModelWithResponseStream and ConverseStream). The guardrail evaluates content as it streams, so this is not a limitation.

Key Takeaway: Regex-based sensitive information filters match specific patterns. If PII appears in non-standard or obfuscated formats, you need to add custom regex patterns to detect those variations.