---
title: How do you force every Amazon Bedrock model call to use a guardrail?
url: https://opencontroller.lyzr.com/blog/force-amazon-bedrock-guardrails-with-iam
published: 2026-11-14
updated: 2026-11-14
author: Lyzr
---

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

**Use the `bedrock:GuardrailIdentifier` IAM condition key. Allow `InvokeModel` and `Converse` only when the request names an approved guardrail, and add an explicit deny for any other guardrail. Calls without the right guardrail fail with access denied. It covers direct model calls; it does not cover Bedrock Agents or Knowledge Bases calls, partial prompts marked with input tags, or any traffic outside Bedrock.**

Amazon Bedrock Guardrails filter harmful content, denied topics, sensitive information and ungrounded answers. On its own, a guardrail is opt-in: the developer must reference it in each request. In March 2025 AWS added IAM policy-based enforcement, so security teams can make it mandatory. This guide is part of our [guide to governing AI agents across platforms](/blog/how-to-govern-ai-agents-across-platforms).

## Which APIs does the condition key cover?

According to AWS, the condition key applies to:

- `InvokeModel`
- `InvokeModelWithResponseStream`
- `Converse`
- `ConverseStream`

If the guardrail in the request does not match the guardrail in the policy, the request is rejected. The key is available in every Region where Bedrock Guardrails is supported.

## What does the policy look like?

The pattern AWS describes has three statements:

1. **Allow** `bedrock:InvokeModel` and `bedrock:InvokeModelWithResponseStream` (and the Converse equivalents) on foundation model resources, with a `StringEquals` condition on `bedrock:GuardrailIdentifier` set to the approved guardrail ARN.
2. **Deny** the same actions with `StringNotEquals` on the same key, so no other permission can bypass it.
3. **Allow** `bedrock:ApplyGuardrail` on the guardrail ARN, because the guardrail itself must be callable.

The guardrail ARN can include a version. Choose the matching pattern deliberately:

| Goal | Operator | Identifier |
|---|---|---|
| One fixed version | StringEquals | `.../guardrail/name:1` |
| Draft version only | StringEquals | `.../guardrail/name` |
| Any numbered version | StringLike | `.../guardrail/name:*` |
| Any version including draft | StringLike | `.../guardrail/name*` |
| An approved list | StringEquals with an array | Several ARNs |

For production agents, pin a numbered version. Allowing the draft lets anyone who can edit the guardrail change production behaviour without a release.

## Where should the policy live?

Attach it to the roles your agents use, and consider an SCP or permissions boundary so new roles cannot be created without it. A role-level policy is easy to get right and easy to forget on the next role. An organisation-level control applies the rule to every account, though you will need exceptions for the cases below.

## What does IAM enforcement not cover?

AWS lists known limitations, and they matter for agents:

- **Bedrock Agents and Knowledge Bases.** Do not use a guardrail-restricted role for `InvokeAgent` or `RetrieveAndGenerate`. These services make extra `InvokeModel` calls, some without the guardrail, so they fail with access denied. Use separate roles, and configure guardrails on the agent or knowledge base itself.
- **Input tags.** A caller can wrap parts of a prompt in input tags so only those parts are evaluated. The rest of the input skips the guardrail, although the response is still fully checked.
- **Cross-account.** Resource-based policies for cross-account guardrail access are not supported.

Two wider gaps also apply. The control only sees calls that go to Bedrock: an agent that calls another provider directly, or a model hosted elsewhere, is outside it. And a guardrail checks content, not actions. It will not stop an agent from calling a tool it should not use. Our comparison of [Bedrock Guardrails and agent governance](/blog/amazon-bedrock-guardrails-vs-agent-governance) covers the difference.

## How do you prove the guardrail is being applied?

Turn on Bedrock model invocation logging to CloudWatch Logs or Amazon S3. It captures request and response data, including guardrail trace details. Use CloudTrail to record guardrail configuration changes and access-denied events from the policy. A rising count of denied calls from one role usually means a team is trying to call models without the guardrail, which is worth a conversation. See [auditing Amazon Bedrock model calls](/blog/audit-amazon-bedrock-model-calls).

## What checklist should you follow?

1. Create and version the guardrail; record the version in your agent registry.
2. Write the allow-plus-deny policy for the agent roles, pinned to that version.
3. Grant `ApplyGuardrail` on the guardrail.
4. Create separate roles for Bedrock Agents and Knowledge Bases.
5. Decide whether input tags are allowed and test both cases.
6. Enable invocation logging and alert on access-denied spikes.
7. Find model traffic that does not go through Bedrock at all.

## How Opencontroller does this

Opencontroller auto-discovers agents, models and API keys across AWS, Azure and Google Cloud, which helps find model traffic that bypasses Bedrock. Posture flags risky permission and configuration patterns, and Opencontroller adds live groundedness and task-adherence guardrails, plus policy as code across platforms. It has a runtime adapter for Bedrock AgentCore. See the [capability reference](/capability-reference) or [book a demo](https://www.lyzr.ai/book-demo/).

## Frequently asked questions

**Can I make Bedrock Guardrails mandatory?**
Yes. Use the `bedrock:GuardrailIdentifier` condition key to allow model calls only with an approved guardrail, plus an explicit deny for any other.

**Does the condition key work with Bedrock Agents?**
No. AWS advises against using guardrail-restricted roles for `InvokeAgent` or `RetrieveAndGenerate`, because those services make model calls without the guardrail. Use separate roles.

**Should I allow the draft guardrail version in production?**
No. Pin a numbered version so changes to the guardrail go through a release.

## Key facts

- The bedrock:GuardrailIdentifier IAM condition key (March 2025) makes a specific guardrail mandatory for model inference.
- It covers InvokeModel, InvokeModelWithResponseStream, Converse and ConverseStream; mismatched guardrails cause access denied.
- AWS's pattern: allow with StringEquals, deny with StringNotEquals, and allow bedrock:ApplyGuardrail on the guardrail ARN.
- Limitations: not for InvokeAgent or RetrieveAndGenerate roles; input tags can leave parts of prompts unevaluated; no cross-account resource-based policies.
- Pin a numbered guardrail version in production rather than the draft.
- Opencontroller discovers model traffic across AWS, Azure and Google Cloud and adds live groundedness and task-adherence guardrails.
- Opencontroller starts from $250K per deployment per year.

## Related

- [What do Amazon Bedrock Guardrails cover, and what do they not?](https://opencontroller.lyzr.com/blog/amazon-bedrock-guardrails-vs-agent-governance.md)
- [How do you audit Amazon Bedrock model calls made by AI agents?](https://opencontroller.lyzr.com/blog/audit-amazon-bedrock-model-calls.md)
- [How do you restrict which Amazon Bedrock models agents can use?](https://opencontroller.lyzr.com/blog/restrict-amazon-bedrock-models-with-scps.md)
- [More on Platform Guides](https://opencontroller.lyzr.com/blog/cluster/platform-guides)
