AI Security Maturity Model·AWS v1.0.0

Drag to explore · pinch to zoom

Foundational AI Application SecurityDefense-in-depth layer: AI Application Capability 1 · Model inferenceUse case: AI that answers 👤 CustomerAWS Shared Responsibility Model: who implements and operates this control. Customer = you own it; AWS = AWS operates it and you inherit it; Shared = both have obligations.

c1.3 Filter inputs and outputs with Amazon Bedrock Guardrails

Put a versioned Bedrock guardrail in front of the model to block harmful content, denied topics, and prompt-injection patterns, and to redact PII on both inputs and outputs.

Foundational
Enhanced
Advanced
Effort: Low Impact: High GenAI scopesFrom the AWS Generative AI Security Scoping Matrix.: 3 · Pre-trained models

Implementation guidance

How to implement on AWS

Configure a guardrail with content filters, denied topics, and prompt-attack filters tuned to your risk tolerance; enable PII filters. Deploy a versioned guardrail and invoke it on every model call. Encrypt the guardrail with a customer managed key.

What a guardrail gives you

Amazon Bedrock Guardrails is a policy layer you put in front of the model so safety and privacy rules live outside your prompt and outside your application code. One guardrail can be reused across models and applications, giving you a consistent, auditable safety baseline. It enforces several policy types together:

  • Content filters — block Hate, Insults, Sexual, Violence, Misconduct, and Prompt Attack (prompt injection / jailbreak) categories, with an adjustable strength per category.
  • Denied topics — natural-language topics your application must refuse (e.g. "investment advice").
  • Word filters — exact-match words/phrases to block (profanity, competitor names).
  • Sensitive information filters — detect PII and either block the request or redact it from the response.

Create a versioned guardrail

Define the policies once and create a guardrail. The content-filter block below turns on prompt-attack detection on inputs and harmful-content filtering on both sides:

aws bedrock create-guardrail \
  --name "prod-genai-guardrail" \
  --description "Baseline safety + PII controls for the app" \
  --blocked-input-messaging "Your request was blocked by our safety policy." \
  --blocked-outputs-messaging "The response was blocked by our safety policy." \
  --content-policy-config '{
    "filtersConfig": [
      { "type": "PROMPT_ATTACK", "inputStrength": "HIGH", "outputStrength": "NONE" },
      { "type": "HATE",          "inputStrength": "HIGH", "outputStrength": "HIGH" },
      { "type": "VIOLENCE",      "inputStrength": "HIGH", "outputStrength": "HIGH" }
    ]
  }' \
  --sensitive-information-policy-config '{
    "piiEntitiesConfig": [
      { "type": "EMAIL",              "action": "ANONYMIZE" },
      { "type": "CREDIT_DEBIT_CARD_NUMBER", "action": "BLOCK" }
    ]
  }'
Note: PROMPT_ATTACK only supports inputStrength (it is an input-side detection), so its outputStrength must be NONE.

Pin a version and apply it

create-guardrail returns a guardrailId. Publish an immutable version with create-guardrail-version, then reference guardrailIdentifier + guardrailVersion on every call — either as parameters to InvokeModel/Converse, or independently with the ApplyGuardrail API to screen text before you even invoke a model:

aws bedrock-runtime apply-guardrail \
  --guardrail-identifier "gr-0abc123456789def0" \
  --guardrail-version "1" \
  --source "INPUT" \
  --content '[{"text":{"text":"<user prompt to screen>"}}]'

Applying the guardrail before invocation lets you reject a bad prompt without paying for a model call.

Naming note: pin a specific guardrailVersion in production rather than the mutable DRAFT, so a policy change is a deliberate, reviewable deploy.

How it fits together

User prompt / response Bedrock Guardrail versioned policy layer INPUT checks prompt-attack · denied topics word filters OUTPUT checks harmful content · PII redaction contextual grounding Model Amazon Bedrock FM prompt → ← response Blocked input never reaches the model; blocked output never reaches the user.
The guardrail sits between the user and the model, screening the prompt on the way in (prompt-attack, denied topics, word filters) and the completion on the way out (harmful content, PII redaction, grounding). Blocked input never reaches the model; blocked output never reaches the user.

Acceptance criteria

Every inference path invokes a versioned guardrail; a test prompt-injection and a PII sample are blocked/redacted; guardrail activation metrics appear in CloudWatch.

Practical implementation

How this control is implemented in each reference architecture:

A versioned guardrail defined in the Generative AI account is applied to every InvokeModel call, so no inference path bypasses content, prompt-attack, and PII filters.

  1. In the Generative AI account, create a guardrail with content filters, denied topics, prompt-attack filters, and PII filters tuned to your risk tolerance, and publish a numbered version.
    Generative AI account Amazon Bedrock
  2. Pass the guardrailIdentifier and guardrailVersion on every InvokeModel/Converse call from the application, and deny (via IAM condition) invocations that omit the guardrail.
    Generative AI account Amazon Bedrock IAM
  3. Encrypt the guardrail with the customer managed key and emit guardrail activation metrics to CloudWatch for monitoring.
    Generative AI account AWS KMS CloudWatch

How to validate: A test prompt-injection string and a PII sample are blocked/redacted; CloudWatch shows guardrail intervention metrics; an InvokeModel call without a guardrail is denied.

Avoid: Attaching the guardrail in the UI console but leaving direct SDK/API calls able to skip it. Enforce the guardrail on every path, ideally with an IAM condition, not by convention.

Generative AI OU (multi-account) →

One versioned guardrail in the account is invoked on every model call from the generative AI tier, with filters enabled from day one.

  1. Create a guardrail with content, denied-topic, prompt-attack, and PII filters and publish a version; treat the version id as a deployable artifact.
    Generative AI tier (IAM role) Amazon Bedrock
  2. Wire the guardrail id/version into the application's Bedrock calls so every request and response passes through it; reject code paths that call the model without it.
    Application tier (IAM role) Amazon Bedrock
  3. Encrypt the guardrail with the customer managed key and send intervention metrics to CloudWatch.
    In-account logging AWS KMS CloudWatch

How to validate: A synthetic injection and a PII sample are blocked/redacted; CloudWatch shows guardrail metrics; no application code path calls the model without the guardrail.

Avoid: Shipping the app first and 'adding guardrails later'. Enable the guardrail from the first deploy; retrofitting it after launch leaves an exposed window.

Single account (entry point) →

Threats addressed

  • Prompt injection embedding hidden instructions in user input.
  • Sensitive data disclosure through model responses.

AWS services

Amazon Bedrock Guardrails

Pricing

Guardrails are billed by the volume of text evaluated (per 1,000 text units) and by the policies enabled; sensitive-information and contextual-grounding checks are priced separately. See the Amazon Bedrock pricing page for current rates. See Detect and filter harmful content by using Amazon Bedrock Guardrails.

Framework mappings

OWASP GenAI/LLM Top 10 (2026)

  • LLM01 Prompt Injection
  • LLM02 Sensitive Information Disclosure

NIST AI Risk Management Framework (AI 100-1)

  • MEASURE.2 AI systems are evaluated for trustworthy characteristics
  • MANAGE.1 AI risks are prioritized, responded to and managed

AWS Well-Architected Generative AI Lens (Security)

  • GENSEC02-BP01 Implement guardrails to mitigate harmful or incorrect model responses
  • GENSEC04-BP02 Sanitize and validate user inputs to foundation models

Learning resources

References

  • AWS AI Security Framework — AI application layer