Skip to main content
I’m working in the Bedrock console inside the AWS Management Console. In the left-hand menu, under Build, there’s a Guardrails option. If you haven’t created any guardrails yet, this page will be empty; in my example there’s already a guardrail named KodeKloud and it’s ready to use. To apply a guardrail to a model call, include the guardrail identifier and version in your Bedrock request (for example, with the InvokeModel or Converse operations). Bedrock performs an input check on the incoming prompt before it reaches the foundation model, and an output check after the model generates a response. Only when these checks pass will your application receive the model output. If a check flags abusive or malicious content, the guardrail can return a fallback or safe response (for example, “Sorry, unable to comply with your request”) or a custom message you define.
A diagram titled "Workflow: How Guardrails Work" showing AWS Bedrock as a dashed-box mediator performing "Input Check" and "Output Check" between "Your Application" (left) and a "Foundation Model" (right). A lower arrow points to a "Fallback / Safe Response" box for handling unsafe outputs.
Versioning and immutability At the top of a guardrail page (e.g., KodeKloud) you’ll see a version number such as “version 1.” Guardrails are immutable after publication — to change behavior you publish a new version (version 2, version 3, etc.). This versioned approach gives you traceability and precise control over which applications reference which guardrail behavior.
Guardrails are versioned and immutable. To change behavior, publish a new version and point applications to that new version when ready.
Content filters and enforcement options Under Content Filters you can enable categories such as hate, insults, sexual content, violence, and misconduct. Filters apply to both prompts (input checks) and model outputs (output checks). For each category you choose whether to enable the filter and what action to take (for example, BLOCK).
A slide titled "Workflow: How Guardrails Work" showing an AWS Bedrock console screenshot of a guardrail version overview. The page displays content filters for harmful categories (hate, insults, sexual, violence, etc.) with filters enabled and actions set to BLOCK.
Guardrail request parameters Code examples Below are concise examples using the Python boto3 SDK showing how to attach a guardrail to InvokeModel and Converse calls. The only change from a standard Bedrock invocation is adding the guardrail identifier and version to the request. InvokeModel example (single-turn / one-off calls)
Expected (blocked) JSON response when a guardrail blocks the request:
Converse example (recommended for multi-turn/chat-style interactions)
Centralized policy management Adding a guardrail to model calls is a small change in each client application but centralizes filtering in Bedrock. This avoids duplicating filtering logic across many apps and simplifies policy updates: publish a new guardrail version and have applications reference that version when you’re ready. Why use guardrails instead of manual filtering? Practical use cases Guardrails are appropriate for a range of scenarios:
  1. Block unsafe or inappropriate content (centrally enforced).
  2. Prevent prompt injection attempts that try to override system instructions or reveal sensitive data.
  3. Control tone and behavior to avoid reputational harm.
  4. Enforce organizational policies consistently across all GenAI applications.
A presentation slide titled "Workflow: Practical Use Cases" with four numbered boxes. The boxes list: block unsafe or inappropriate content; prevent prompt injection attempts; control tone and behavior; and enforce organizational policies.
References and further reading

Watch Video