Back to Checks
aws

Amazon Bedrock agent uses a guardrail to protect agent sessions

bedrock_agent_guardrail_enabled
Service: bedrockSeverity: high
OfficialBuilt-inVerified
Categories:gen-ai
Resource Type:Other

Bedrock agents should have an associated guardrail for their sessions. The evaluation identifies agents without a guardrail linked for input/output screening during interactions.

Risk

Without guardrails, agent exchanges may expose PII or internal data (confidentiality), accept prompt injections that manipulate tool calls or outputs (integrity), and produce unsafe or out-of-scope responses that erode trust and cause policy violations.

Run this check with Prowler

Run in Prowler Cloud
Run
prowler aws --checks bedrock_agent_guardrail_enabled

Recommendation

Associate a guardrail with every agent and tailor policies to your use case:

  • Enable content/word filters, denied topics, and sensitive-data masking
  • Use contextual grounding for RAG where relevant
  • Test and iterate across versions Apply least privilege to agent tools and use defense in depth with monitoring and review.

Remediation

CLI

aws bedrock-agent update-agent --agent-id <agent_id> --agent-name <agent_name> --agent-resource-role-arn <role_arn> --foundation-model <model_id> --guardrail-configuration guardrailIdentifier=<guardrail_id>,guardrailVersion=DRAFT

Terraform

# Terraform (AWS Cloud Control): Associate a guardrail with a Bedrock Agent
resource "awscc_bedrock_agent" "example" {
  agent_name               = "<example_resource_name>"
  agent_resource_role_arn  = "<example_resource_id>"
  foundation_model         = "<example_resource_name>"
  instruction              = "<example_resource_name>"

  # CRITICAL: associates a guardrail to protect agent sessions
  guardrail_configuration {
    guardrail_identifier = "<example_resource_id>"   # CRITICAL: guardrail ID
    guardrail_version    = "DRAFT"                   # CRITICAL: version applied
  }
}

NativeIaC

# CloudFormation: Associate a guardrail with a Bedrock Agent
Resources:
  ExampleAgent:
    Type: AWS::Bedrock::Agent
    Properties:
      AgentName: <example_resource_name>
      AgentResourceRoleArn: <example_resource_id>
      FoundationModel: <example_resource_name>
      Instruction: "<example_resource_name>"
      GuardrailConfiguration:  # CRITICAL: associates a guardrail to protect sessions
        GuardrailIdentifier: <example_resource_id>  # CRITICAL: guardrail ID used by the agent
        GuardrailVersion: DRAFT  # CRITICAL: version applied

Other

1Open the Amazon Bedrock console and go to Agents
2Select the agent and click Edit
3In Guardrail details, select an existing guardrail and its version (e.g., DRAFT)
4Click Save (deploy changes if prompted)
5Verify the agent now shows the selected guardrail

Check Code

from prowler.lib.check.models import Check, Check_Report_AWS
from prowler.providers.aws.services.bedrock.bedrock_agent_client import (
    bedrock_agent_client,
)


class bedrock_agent_guardrail_enabled(Check):
    def execute(self):
        findings = []
        for agent in bedrock_agent_client.agents.values():
            report = Check_Report_AWS(metadata=self.metadata(), resource=agent)
            report.status = "FAIL"
            report.status_extended = f"Bedrock Agent {agent.name} is not using any guardrail to protect agent sessions."
            if agent.guardrail_id:
                report.status = "PASS"
                report.status_extended = f"Bedrock Agent {agent.name} is using guardrail {agent.guardrail_id} to protect agent sessions."

            findings.append(report)

        return findings