Skip to main content

AWS Web Application Firewall

AWS WAF AI Security

Why AWS WAF AI Security?

The AWS WAF AI Security managed rule group is part of the overall solution enabling you to discover language model (LLM), Model Context Protocol (MCP), and Agent2Agent (A2A) endpoints behind Amazon API Gateway, Application Load Balancers, and Amazon CloudFront across your AWS Organization and protect them using AWS WAF.

Discovery is available through the new API Gateway API Portal, which recognizes the AI endpoints among the APIs it discovers automatically from traffic logs and service configuration records, with no agents to deploy or logs to forward. An undocumented, public-facing MCP server appears as a shadow API. For unprotected AI endpoints, customers can enable protection using WAF.

Protection is available through the AWS WAF AI Security managed rule group, which protects your AI endpoints. AWS WAF implements protocol recognition and compliance checks to block malformed MCP and A2A messages. When you enable content inspection, the rule group calls Amazon Bedrock Guardrails InvokeGuardrailChecks API to detect prompt injection, jailbreak attempts, harmful content in requests, and sensitive information in responses. You can use AI Security alongside other AWS Managed Rules or your own custom rules to protect your applications. Additional fees apply, and Amazon Bedrock charges separately for content inspection calls.

Together, API Portal and AI Security provide you a complete solution from discovery of all AI endpoints in your AWS environment to protecting them, without having to write any custom rules.

Benefits of AWS WAF AI Security

    Enable AI Security by adding the AWS WAF AI Security managed rule group, with its required configuration, to a web ACL. Protection applies to the AI and agent endpoints already behind AWS WAF. There is no agent, no sensor, no SDK, and no change to your application or your model, because the rule group runs inline where your requests arrive.

    The rule group classifies LLM, MCP, and A2A traffic and applies deterministic protocol compliance checks to MCP and A2A messages, with no call to Amazon Bedrock. When the rule group recognizes the traffic type, it adds a label to the request. Rules are grouped into baseline and strict checks with configurable actions.

    When you enable content inspection and supply an IAM role, AWS WAF calls Amazon Bedrock Guardrails to help detect prompt attacks such as prompt injection and jailbreak attempts, harmful content in requests, and sensitive data in responses.

    Every detection adds a label recording what the traffic was classified as, which check or enforcement level it failed, and the severity and category of any content finding returned by Bedrock Guardrails. Request labels appear in your AWS WAF logs and sampled requests. Request and response labels appear in Amazon CloudWatch metrics. All findings are available alongside your existing WAF telemetry, not in a separate console.

    You can override the action on any rule, scope down which endpoints are evaluated, pin a rule group version, and write your own rules against the labels the rule group adds. If an inspection call fails, the request is labeled and counted so traffic keeps flowing. You can override that rule to block instead.

Use cases

    MCP and A2A are defined protocols, so a request either complies with the version it declares or it does not. The AI Security managed rule group applies compliance checks at two levels: a baseline level that no compliant client trips, which is safe to enforce from the start, and a stricter level that begins in count mode so you can observe what your own clients send before you enforce it.

    A prompt that instructs a model to ignore its instructions, reveal its system prompt, or act outside its intended role arrives as an ordinary, well-formed request. With content inspection enabled, the AI Security managed rule group calls Bedrock Guardrails to evaluate what a request says, not only how it is formed, and blocks the identified high-severity prompt attacks by default before your model acts on them.

    A model, agent, or MCP server can disclose credentials or personal data in its output, and a control that inspects only requests will never see it. With response inspection enabled, AI Security calls Bedrock Guardrails to evaluate the endpoint's response as well as the request and labels sensitive data on the way out, so you can count it or block it.