Applying Content and Compliance Controls with Bedrock Guardrails
This lesson explains the policies a Bedrock guardrail can apply, where guardrails are applied and how to enforce them across an organisation.
Learning outcomes
After completing this lesson, you will be able to:
- Describe each guardrail policy and the requirement it addresses.
- Explain how guardrails apply to Bedrock calls and to other models through ApplyGuardrail.
- Choose a mechanism that enforces a guardrail on every model invocation.
Guardrail policies
A guardrail combines several policies, each optional. Content filters detect hate, insults, sexual content, violence, misconduct and prompt attacks (jailbreaks and prompt injection) at adjustable strengths. Denied topics describe subjects the application must not engage with, such as investment advice, in natural language with example phrases. Word filters block profanity and custom words. Sensitive information filters detect PII types (such as card numbers, national IDs, email addresses) and custom regular expressions, and either block or mask them.
Two policies address accuracy. Contextual grounding checks score whether a response is supported by the source passages and relevant to the question, which suits RAG applications. Automated Reasoning checks translate written rules, such as an HR or lending policy, into formal logic and verify whether a response is consistent with them, giving explainable, logic-based results.
Guardrail policies
Where guardrails apply
A guardrail is versioned and referenced on Converse and InvokeModel requests, on knowledge base and agent calls, or applied to any text with the ApplyGuardrail API, which lets the same policies protect models hosted on SageMaker AI or outside AWS. Each intervention is recorded in the response trace and in CloudWatch metrics, so compliance teams can monitor how often content is blocked and why.
The following table maps typical requirements to guardrail policies.
| Requirement | Policy |
|---|---|
| Never reveal card numbers in answers, but still answer | Sensitive information filter with mask |
| Refuse investment advice | Denied topic |
| Block jailbreak attempts | Content filter for prompt attacks |
| Block answers not supported by retrieved documents | Contextual grounding check |
| Verify answers against written eligibility rules | Automated Reasoning check |
The following diagram shows the two points at which a guardrail checks a model interaction.

Enforcing guardrails across an organisation
A guardrail only helps if it is used. Two mechanisms enforce it without relying on developers. The bedrock:GuardrailIdentifier condition key in an IAM policy or SCP denies inference requests that do not specify the approved guardrail (and version). Amazon Bedrock policies in AWS Organizations attach a guardrail to the organisation, OUs or accounts, so it is applied to model invocations in those accounts in addition to any application guardrail, with the most restrictive setting winning; member accounts need permission to apply the guardrail through its resource-based policy.
Enforcing guardrails
A banking assistant
A bank's assistant answers questions about accounts and products from a knowledge base. Compliance requires no investment advice, masked account and card numbers, protection against jailbreaks, and no answers that the source documents do not support, in every account that builds customer-facing AI.
The governance team creates one guardrail with a denied topic for investment advice, sensitive information filters with the mask action, the prompt attack filter at high strength and contextual grounding checks. It attaches the guardrail to the customer-facing OU with an Organizations Bedrock policy, and CloudWatch alarms on guardrail interventions alert the team if blocking suddenly increases, which may signal an attack or a broken prompt.
A team hosts a model on SageMaker AI but wants the company's Bedrock guardrail applied. Is that possible?
Show answer
Yes. The ApplyGuardrail API evaluates any text against a guardrail, so the application applies it to inputs before calling the endpoint and to outputs before returning them.
Exam Tips
Remember for the exam
- Mask PII but still answer: sensitive information filter with the mask action.
- Block unsupported answers in RAG: contextual grounding checks; logic-based policy verification: Automated Reasoning checks.
- Every model call must use the approved guardrail: bedrock:GuardrailIdentifier condition or an Organizations Bedrock policy.
- Apply the same policies to a self-hosted model: ApplyGuardrail API.