Part 1 — Build the guardrail in AWS (TBD)
This walkthrough is being written against a real account. Until then, follow
AWS’s own documentation to create the guardrail, and come back for Part 2.
Contextual grounding is read but can never fire. The gateway sends one
unqualified block of text and never marks any part of it as the grounding source
or the query, which is what AWS requires before it evaluates grounding or
relevance. A guardrail whose only active policy is contextual grounding will
allow everything, and it will look exactly like a guardrail that is working.
Part 2 — Give the gateway access to AWS
The gateway needs to callbedrock:ApplyGuardrail on your guardrail. There are
two ways, and they are the only two.
Method A — IAM role (STS)
You create a role in your account that may call the guardrail, and the gateway assumes it. Choosing IAM role (STS) in the policy hides the key fields entirely: the gateway assumes the role as its own identity — the instance or pod identity it already runs with — and stores nothing of yours but the ARN. The role needsbedrock:ApplyGuardrail on the guardrail, and its trust policy
has to permit the gateway’s identity to assume it. Ask your NeuralTrust contact
for that identity.
Method B — Static keys
Create an IAM user withbedrock:ApplyGuardrail on the guardrail and paste its
access key ID and secret into the policy. Session token is there for
temporary credentials.
Part 3 — Configure the policy in TrustGate
Open Policies → Library → AWS Bedrock Guardrail.AWS connection
Guardrail
Guardrail ID — the guardrail’s identifier in AWS. Required, and the console checks only that it is not empty; whether it exists is discovered on the first request.When triggered
PII action — Block request (the default) or Anonymize. Read the warning in Part 1 before changing it: this decides what the gateway does with an anonymised verdict from AWS, and it does nothing at all unless the entity is set to anonymise on the AWS side. Block message — leave your expectations low here.Advanced Settings
Guardrail version — defaults toDRAFT. Point production at a published
version number instead: DRAFT changes the moment anyone edits the guardrail in
AWS, with no change to this policy and no event to tell you.
Session name — the STS session name, for the IAM role method. Defaults to
BedrockClientSession. It shows up in CloudTrail, which is the only reason to
change it.
Stage and mode
The form offers no choice of leg. A policy you create here screens the request on its way to the model, which this policy always does. The gateway can also screen the model’s answer for this policy — evaluating it, and masking it in place — but the form has no control for it, so today it can only be turned on outside the console. Start in Observe, which records every decision without refusing or rewriting anything, and switch to Enforce once the decisions look right.How the decision is made
1
One message is sent to the guardrail
The most recent
user message, as described at the top of this page. One call
per request.2
AWS's assessments are read in a fixed order
Denied topics, then content filters, then word lists, then sensitive
information, then contextual grounding. The first blocking finding wins and
is the one named in the response — regardless of how many others also matched,
and regardless of which you would consider the more serious.
3
A blocking finding refuses the request
The request never reaches the model. The caller gets
403, and the response
names which of the guardrail’s policies fired — denied topics, content filters,
word lists, sensitive information or contextual grounding — and, where AWS
provides one, the name it matched.4
Masking applies only if nothing blocked
With PII action set to Anonymize, and AWS coming back with an anonymised
verdict, the masked text AWS returned replaces the original message and the
request continues to the model. The model never sees the original.
5
Otherwise the request passes through untouched
Modes and failures
Observe never masks. It records what would have happened and forwards the
original text. Masking is only ever applied in Enforce.
Limits
- Only the last user message is inspected on the request leg. No system prompt, no conversation history, no tool definitions, no tool calls or results.
- Contextual grounding can never fire. See the note in Part 1. A guardrail relying on it looks healthy and allows everything.
- The form cannot turn on screening of the model’s answer. A policy created there inspects requests only.
- Streaming responses are not inspected, on any leg. They pass through untouched.
- The block message is never returned to the caller.
- Text only. Files, images and audio are not sent to AWS.
- LLM traffic only. The policy does not apply to MCP (Model Context Protocol) tool calls.
Verify the policy
Open the Playground, pick the application the policy applies to, and send these three prompts in this order. Starting with the control means a failure tells you something specific.1
Control — the path works at all
allowed. In Enforce, a 502
here means the gateway could not get an answer out of AWS at all: region,
credentials, permission or guardrail ID. Nothing below will work until this
does.2
Sensitive information — masking works
Send a prompt containing an entity your guardrail is configured to anonymise,
for example an email address:With PII action set to Anonymize, expect the decision
anonymized.Read the reply, not just the status. It must not contain the address. That
is what proves the model never received it.If you get a 403 instead, the two settings disagree: either the entity is set
to Block in AWS, or PII action is still Block request. If you get a
plain allowed, the entity is not in your guardrail at all.3
A denied topic — blocking works
Send something your guardrail’s denied topics or content filters should refuse.Expect the decision
block, a 403 naming the policy that fired, and no
time at the provider in the timing breakdown. That the provider leg is empty is
the evidence that matters: the request never reached the model.Troubleshooting
Related
- Guardrails — the other guardrail policies, and how to choose between them
- Google Model Armor — the other provider guardrail that can mask in place
- Policies overview — scope, modes and policy chains
- Event schema — the fields each decision records