Skip to content
GitHubOpen source
Product
Docs
Solutions
IndustriesAll industries
CompareCompare all AI data-leak tools
Benchmarks
GitHubApache-2.0

Shadow vs AWS Comprehend and Bedrock Guardrails — a self-hosted alternative

AWS offers two PII services relevant to LLMs: Amazon Comprehend detects and redacts PII in text, and Amazon Bedrock Guardrails can block or anonymise PII in prompts and responses for Bedrock models. Shadow is an open-source privacy layer that replaces sensitive values with realistic, reversible fakes before a request reaches any provider, and restores them in the answer. If you run everything on Bedrock and want managed guardrails, AWS is the natural fit. If you call several providers, need the real values back in responses, or want data masked before it leaves your machine, Shadow covers that.

ShadowAWS Comprehend / Bedrock Guardrails
Open source / licenceYes, Apache-2.0No, proprietary AWS services
DeploymentEndpoint HTTPS proxy, gateway (/gw/<provider>/), Rust libraryAWS-managed APIs; Guardrails attach to Bedrock calls or the ApplyGuardrail API
Protection methodReversible realistic fakes; typed tokens for reports; optional redactionComprehend: detect and redact. Guardrails: BLOCK or ANONYMIZE with type tags, plus custom regex
Restores responsesYes, automaticallyNo
StreamingYes, SSE and NDJSONGuardrails streaming behaviour not verified here; Comprehend is not a stream processor
Tool callsYes, restored locally; intent-awareNo PII-specific tool-call handling documented
FilesDOCX, XLSX, PPTX in place; PDF to textComprehend async batch jobs on documents in S3
Self-hostedYesNo
Price modelFreeUsage-based (per text unit)
  • Managed and integrated. No servers to run. Guardrails attach directly to Bedrock model invocations and agents, with IAM, CloudWatch and CloudTrail around them.
  • More than PII. Bedrock Guardrails also offers content filters, denied topics, word filters and contextual grounding checks. Shadow only handles sensitive values.
  • Strong generic detection. In Tonic’s vendor-run benchmark (October 2025), Comprehend scored highest of the generic detectors tested, ahead of several open-source options. Treat vendor benchmarks with care, but it is a strong signal.
  • Batch processing. Comprehend runs asynchronous PII jobs over documents stored in S3, which suits dataset preparation.
  • Custom patterns. Guardrails accept custom regex for organisation-specific identifiers; AWS documents regex filters as not charged separately (per a third-party pricing guide).

Does Bedrock Guardrails give the real values back?

Section titled “Does Bedrock Guardrails give the real values back?”

No. ANONYMIZE replaces values with type tags, so a prompt about Jane Doe reaches the model as {NAME}, and the answer mentions {NAME} too. That is safe, but the user gets a less useful answer and has to fill in the blanks. Shadow sends Hui Zhao instead, from a persistent persona, and turns it back into Jane Doe before your app sees the response.

A Shadow fake email is a valid email at a consistent fake domain; a fake card number passes Luhn; an IBAN passes mod-97. The model reasons about a coherent fake world. Type tags lose the distinction between two people of the same type and break tasks like drafting an email or filling a table.

Works with many providers, not only Bedrock

Section titled “Works with many providers, not only Bedrock”

Shadow masks traffic to OpenAI, Anthropic, Gemini, Azure OpenAI, Mistral, OpenRouter and more, as a proxy or gateway. Bedrock Guardrails protect Bedrock calls (and text you pass to ApplyGuardrail).

With Comprehend, the plaintext you want to protect is sent to an AWS API to be scanned. Shadow detects on the machine that sends the request. For organisations that already trust AWS with the data, this matters less.

Shadow restores fakes split across SSE events and inside streamed tool-call arguments, and its intent policy chooses fakes, typed tokens like [PERSON_0007], or keeps real the recipient of a message and what a provider-hosted action needs (each keep is logged). See tool calls.

Shadow masks DOCX, XLSX and PPTX uploads in place, and base64 or multipart files in requests. See file masking.

Shadow cannot mask Bedrock requests signed with AWS SigV4, because changing the body breaks the signature. It forwards them unmasked with a warning. Bedrock calls authenticated with bearer API keys are masked normally. If your Bedrock usage is IAM-signed, Guardrails are the practical option for that traffic.

  • Your AI workloads run on Bedrock and you want a managed, IAM-governed guardrail.
  • You also need content filters, denied topics or grounding checks.
  • You need batch PII detection on documents in S3.
  • Your requests are SigV4-signed.
  • Placeholder output is acceptable for your use case.
  • You call several model providers, or providers outside AWS.
  • You need the real values back in responses, streams and agent tool calls.
  • You want sensitive data masked before it leaves the machine, not scanned by a cloud API.
  • You want a free, open-source tool you can audit and run anywhere.

Yes. Shadow can mask requests to Bedrock (with API keys) before they arrive, and a Bedrock Guardrail can still apply content filters and denied topics to the masked request. For SigV4-signed traffic, keep Guardrails as the PII control.

Migrating from Bedrock Guardrails PII filters

Section titled “Migrating from Bedrock Guardrails PII filters”
  1. Keep your guardrail for content filters and topics; consider turning off PII ANONYMIZE once Shadow masks the traffic, so the model sees fakes rather than tags.
  2. Switch Bedrock clients to API-key authentication, or add a custom route for your Bedrock endpoint.
  3. Port custom regex patterns to Shadow dictionary terms or a custom detector.
  4. Run shadow scan on representative prompts before switching traffic.

Comprehend performed well in Tonic’s vendor-run benchmark, and the language support is ambiguous in AWS’s own documentation (the API reference lists 12 language codes while other AWS pages say English). Shadow’s benchmark measures leak rate, over-masking and round-trip exactness with published code and mappings; commercial cloud APIs such as Comprehend are not included, because their terms and pricing make public, reproducible runs impractical.


Last reviewed: 2026-10-31. AWS, Amazon Comprehend and Amazon Bedrock are trademarks of their owner; this comparison is based on public documentation as of the review date.

Frequently asked questions

Is Shadow an alternative to Amazon Bedrock Guardrails for PII?

For the PII part, yes. Bedrock Guardrails can block a request or anonymise PII with type tags such as {NAME}, and does not restore the original values. Shadow replaces values with realistic, reversible fakes and restores them in the response. Bedrock Guardrails also covers content filters, denied topics and grounding checks, which Shadow does not.

Can Bedrock Guardrails restore masked PII in the model's response?

Public AWS documentation describes BLOCK and ANONYMIZE actions for sensitive information filters. It does not describe restoring anonymised values in the response, so the user sees tags like {NAME} rather than the real name.

Does Shadow work with Amazon Bedrock?

Yes when Bedrock is called with bearer API keys. Requests signed with AWS SigV4 (IAM) cannot be modified without breaking the signature, so Shadow forwards them unmasked with a warning.

How much does AWS Comprehend PII detection cost?

Comprehend is billed per 100-character unit with a minimum per request; a third-party pricing guide lists about $0.0001 per unit. Check the AWS pricing page for current rates. Shadow is free and runs locally.

Which is more accurate, AWS Comprehend or Shadow?

Comprehend scored well in a vendor-run benchmark by Tonic. Results depend heavily on the dataset and label mapping. Comprehend is not in the Shadow benchmark, because commercial cloud APIs are impractical to run publicly and reproducibly.