Back to Blog
EventBridge for Automated AI Compliance Remediation
Technical Guide·10 min read·

EventBridge for Automated AI Compliance Remediation

C

Claw GRC Team

Claw GRC Team

How to use Amazon EventBridge, Lambda, and Step Functions to build automated remediation workflows for AI compliance violations on AWS, mapped to NIST 800-53, SOC 2, and ISO 27001.

EventBridge for Automated AI Compliance Remediation

Manual compliance remediation is a losing strategy for AI workloads. A SageMaker notebook spun up without encryption at 2 AM should not wait until a security engineer reviews a dashboard at 9 AM to get flagged. A Bedrock invocation bypassing guardrails should not sit in a ticket queue for three days. The gap between violation and remediation is where audit findings live.

Amazon EventBridge closes that gap. It routes AWS service events to remediation targets -- Lambda functions, Step Functions workflows, SNS notifications -- in near real-time. Combined with AWS Config rules for continuous compliance evaluation and Lambda for corrective actions, EventBridge enables fully automated remediation pipelines that detect, respond to, and document AI compliance violations as they occur.

This article builds three complete remediation patterns for AI workloads, explains how to orchestrate multi-step remediation with Step Functions, and maps everything to the compliance frameworks your auditors care about. For the broader AWS AI governance framework, see the Complete Guide to AWS AI/ML Governance.


Why Automated Remediation Matters for AI Compliance

Auditors evaluate two things about your incident response: how fast you detect violations and how fast you resolve them. Mean time to detect (MTTD) and mean time to respond (MTTR) are the metrics that matter. Manual processes give you MTTD measured in hours or days and MTTR measured in days or weeks. EventBridge-driven automation gives you MTTD in seconds and MTTR in minutes.

For AI workloads specifically, the stakes are higher because:

ML resources are expensive to leave misconfigured. An unencrypted SageMaker notebook running overnight is both a compliance violation and a data exposure risk. An overly permissive IAM role on a Bedrock agent compounds its risk every time the agent makes a tool call.

AI compliance frameworks expect automated controls. NIST 800-53 IR-4 requires automated incident handling. SOC 2 CC7.3 requires timely response to identified vulnerabilities. ISO 27001 A.5.24 requires incident management processes. Manual ticket-based workflows do not satisfy the "timely" requirement for high-severity violations.

Volume scales faster than headcount. As your AI workloads grow, the number of potential compliance events grows exponentially. You cannot hire your way out of this problem. You need event-driven automation.


Architecture Overview

The remediation architecture follows a consistent pattern:

  1. Detection -- AWS Config evaluates resources against compliance rules, or AWS services emit events directly to EventBridge
  2. Routing -- EventBridge rules match event patterns and route to appropriate targets
  3. Remediation -- Lambda functions or Step Functions workflows execute corrective actions
  4. Documentation -- Every remediation action is logged, creating audit evidence automatically
AWS Config Rule / Service Event
        │
        ▼
   EventBridge Rule (pattern match)
        │
        ├──▶ Lambda (simple remediation)
        │
        ├──▶ Step Functions (multi-step remediation)
        │
        └──▶ SNS (notification)
              │
              ▼
         Claw GRC (evidence collection)

Every component in this pipeline produces logs and artifacts that become compliance evidence. The remediation itself is the evidence -- timestamped proof that your organization detected and resolved a violation within your SLA.


Pattern 1: Unencrypted SageMaker Notebooks -- Auto-Stop and Notify

SageMaker notebook instances created without KMS encryption violate encryption-at-rest requirements in virtually every compliance framework. This pattern detects unencrypted notebooks and automatically stops them.

AWS Config Rule for SageMaker Encryption

# Create a custom Config rule that checks SageMaker notebook encryption
aws configservice put-config-rule \
  --config-rule '{
    "ConfigRuleName": "sagemaker-notebook-encrypted",
    "Description": "Ensures all SageMaker notebook instances use KMS encryption",
    "Scope": {
      "ComplianceResourceTypes": ["AWS::SageMaker::NotebookInstance"]
    },
    "Source": {
      "Owner": "CUSTOM_LAMBDA",
      "SourceIdentifier": "arn:aws:lambda:us-east-1:123456789:function:check-sagemaker-encryption",
      "SourceDetails": [
        {
          "EventSource": "aws.config",
          "MessageType": "ConfigurationItemChangeNotification"
        }
      ]
    }
  }'

EventBridge Rule and Lambda Remediation

import boto3
import json
import os
from datetime import datetime, timezone

sagemaker = boto3.client("sagemaker")
sns = boto3.client("sns")
config = boto3.client("config")

ALERT_TOPIC = os.environ["ALERT_TOPIC_ARN"]


def handler(event, context):
    """Auto-stop unencrypted SageMaker notebooks and create compliance ticket."""
    detail = event["detail"]
    notebook_name = detail["resourceId"]

    # Verify the notebook is non-compliant
    notebook = sagemaker.describe_notebook_instance(
        NotebookInstanceName=notebook_name
    )

    if notebook.get("KmsKeyId"):
        return {"action": "no_remediation_needed", "reason": "notebook is encrypted"}

    # Stop the notebook
    if notebook["NotebookInstanceStatus"] == "InService":
        sagemaker.stop_notebook_instance(NotebookInstanceName=notebook_name)

    # Tag the notebook with remediation metadata
    sagemaker.add_tags(
        ResourceArn=notebook["NotebookInstanceArn"],
        Tags=[
            {"Key": "compliance-violation", "Value": "encryption-at-rest-missing"},
            {"Key": "remediation-action", "Value": "auto-stopped"},
            {"Key": "remediation-date", "Value": datetime.now(timezone.utc).isoformat()},
        ],
    )

    # Notify the team
    sns.publish(
        TopicArn=ALERT_TOPIC,
        Subject=f"REMEDIATED: Unencrypted SageMaker notebook stopped - {notebook_name}",
        Message=json.dumps(
            {
                "violation": "SageMaker notebook without KMS encryption",
                "resource": notebook_name,
                "action_taken": "Notebook stopped automatically",
                "required_follow_up": "Recreate notebook with KMS encryption enabled",
                "compliance_refs": ["SOC2-CC6.7", "NIST-SC-28", "ISO27001-A.8.24"],
                "timestamp": datetime.now(timezone.utc).isoformat(),
            },
            indent=2,
        ),
    )

    return {
        "action": "remediated",
        "notebook": notebook_name,
        "status": "stopped",
    }

The Lambda stops the notebook immediately, tags it with remediation metadata for audit trails, and sends a notification with specific compliance references. The notebook owner must recreate it with encryption enabled -- there is no automated way to add encryption to a running notebook instance.

Compliance mapping: NIST 800-53 SC-28 (protection of information at rest), SOC 2 CC6.7 (encryption), ISO 27001 A.8.24 (use of cryptography).


Pattern 2: Bedrock Calls Without Guardrails -- Alert and Ticket Creation

If your organization requires all Bedrock invocations to use guardrails, you need to detect and flag calls that bypass them. This pattern monitors CloudTrail for Bedrock InvokeModel calls that do not include a guardrail identifier.

EventBridge Rule for Guardrail-Free Bedrock Calls

resource "aws_cloudwatch_event_rule" "bedrock_no_guardrail" {
  name        = "bedrock-invoke-without-guardrail"
  description = "Detects Bedrock model invocations that bypass guardrails"

  event_pattern = jsonencode({
    source      = ["aws.bedrock-runtime"]
    detail-type = ["AWS API Call via CloudTrail"]
    detail = {
      eventName = ["InvokeModel", "InvokeModelWithResponseStream"]
      requestParameters = {
        guardrailIdentifier = [{ "exists" = false }]
      }
    }
  })
}

resource "aws_cloudwatch_event_target" "guardrail_alert" {
  rule      = aws_cloudwatch_event_rule.bedrock_no_guardrail.name
  target_id = "guardrail-violation-handler"
  arn       = aws_lambda_function.guardrail_violation_handler.arn
}

resource "aws_lambda_function" "guardrail_violation_handler" {
  function_name = "bedrock-guardrail-violation"
  runtime       = "python3.13"
  handler       = "index.handler"
  role          = aws_iam_role.remediation_role.arn
  timeout       = 30

  filename         = "guardrail_violation.zip"
  source_code_hash = filebase64sha256("guardrail_violation.zip")

  environment {
    variables = {
      ALERT_TOPIC_ARN  = aws_sns_topic.ml_security_alerts.arn
      TICKET_API_URL   = var.ticket_api_url
    }
  }
}

The EventBridge rule matches on the absence of a guardrailIdentifier in the request parameters. Every Bedrock call without a guardrail triggers the Lambda, which creates a compliance ticket and alerts the security team. This is a detective control -- it does not block the call (only SCPs or IAM can do that) but ensures no violation goes unnoticed.

Compliance mapping: NIST 800-53 IR-4 (incident handling), SOC 2 CC7.3 (response to identified vulnerabilities), ISO 27001 A.5.24 (information security incident management).


Pattern 3: Overly Permissive IAM Roles for ML -- Auto-Restrict

IAM roles for SageMaker and Bedrock that use wildcard permissions (sagemaker:*, bedrock:*) violate least-privilege requirements. This pattern detects overly permissive roles and attaches a permissions boundary that restricts them to safe operations.

Config Rule and Auto-Restriction Lambda

import boto3
import json
import os
from datetime import datetime, timezone

iam = boto3.client("iam")
sns = boto3.client("sns")

ALERT_TOPIC = os.environ["ALERT_TOPIC_ARN"]
BOUNDARY_POLICY_ARN = os.environ["ML_PERMISSIONS_BOUNDARY_ARN"]


def handler(event, context):
    """Attach permissions boundary to overly permissive ML roles."""
    detail = event["detail"]
    role_name = detail["resourceId"]

    # Get current role policies
    role = iam.get_role(RoleName=role_name)

    # Check if boundary is already applied
    if role["Role"].get("PermissionsBoundary", {}).get("PermissionsBoundaryArn") == BOUNDARY_POLICY_ARN:
        return {"action": "already_bounded", "role": role_name}

    # Attach the permissions boundary
    iam.put_role_permissions_boundary(
        RoleName=role_name,
        PermissionsBoundary=BOUNDARY_POLICY_ARN,
    )

    # Tag the role with remediation info
    iam.tag_role(
        RoleName=role_name,
        Tags=[
            {"Key": "compliance-remediation", "Value": "permissions-boundary-applied"},
            {"Key": "remediation-date", "Value": datetime.now(timezone.utc).isoformat()},
            {"Key": "original-issue", "Value": "overly-permissive-ml-role"},
        ],
    )

    # Notify
    sns.publish(
        TopicArn=ALERT_TOPIC,
        Subject=f"REMEDIATED: Permissions boundary applied to {role_name}",
        Message=json.dumps(
            {
                "violation": "Overly permissive IAM role for ML workloads",
                "resource": role_name,
                "action_taken": "Permissions boundary applied",
                "boundary_policy": BOUNDARY_POLICY_ARN,
                "compliance_refs": ["SOC2-CC6.1", "SOC2-CC6.3", "NIST-AC-6", "ISO27001-A.8.3"],
                "timestamp": datetime.now(timezone.utc).isoformat(),
            },
            indent=2,
        ),
    )

    return {"action": "boundary_applied", "role": role_name}

The permissions boundary does not remove existing policies -- it creates a ceiling on effective permissions. The role's attached policies still exist, but any action not allowed by the boundary is denied. This is a safer remediation than modifying policies directly because it is additive and easily reversible.

For a deeper look at IAM policies and SCPs for AI workloads, see AWS Cloud Security for AI Compliance.

Compliance mapping: NIST 800-53 AC-6 (least privilege), SOC 2 CC6.1 (logical access), CC6.3 (role-based access), ISO 27001 A.8.3 (access restriction).


Multi-Step Remediation with Step Functions

Some compliance violations require more than a single Lambda function. A detected model drift violation might require stopping an endpoint, notifying stakeholders, creating a ticket, triggering retraining, and updating the compliance dashboard. Step Functions orchestrate these multi-step workflows with built-in error handling and retry logic.

Step Functions Remediation Workflow

{
  "Comment": "Multi-step remediation for AI compliance violations",
  "StartAt": "ClassifyViolation",
  "States": {
    "ClassifyViolation": {
      "Type": "Choice",
      "Choices": [
        {
          "Variable": "$.violation_severity",
          "StringEquals": "critical",
          "Next": "ParallelCriticalResponse"
        }
      ],
      "Default": "StandardRemediation"
    },
    "ParallelCriticalResponse": {
      "Type": "Parallel",
      "Branches": [
        {
          "StartAt": "IsolateResource",
          "States": {
            "IsolateResource": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:us-east-1:123456789:function:isolate-ml-resource",
              "Retry": [{"ErrorEquals": ["States.ALL"], "MaxAttempts": 3}],
              "End": true
            }
          }
        },
        {
          "StartAt": "NotifySecurityTeam",
          "States": {
            "NotifySecurityTeam": {
              "Type": "Task",
              "Resource": "arn:aws:states:::sns:publish",
              "Parameters": {
                "TopicArn": "arn:aws:sns:us-east-1:123456789:security-critical",
                "Subject.$": "States.Format('CRITICAL: {} - {}', $.violation_type, $.resource_id)",
                "Message.$": "States.JsonToString($)"
              },
              "End": true
            }
          }
        },
        {
          "StartAt": "CreateComplianceTicket",
          "States": {
            "CreateComplianceTicket": {
              "Type": "Task",
              "Resource": "arn:aws:lambda:us-east-1:123456789:function:create-compliance-ticket",
              "End": true
            }
          }
        }
      ],
      "Next": "RecordEvidence"
    },
    "StandardRemediation": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:123456789:function:standard-remediation",
      "Next": "RecordEvidence"
    },
    "RecordEvidence": {
      "Type": "Task",
      "Resource": "arn:aws:lambda:us-east-1:123456789:function:record-compliance-evidence",
      "Parameters": {
        "violation.$": "$",
        "evidence_type": "automated_remediation",
        "timestamp.$": "$$.State.EnteredTime"
      },
      "End": true
    }
  }
}

Critical violations trigger parallel execution: the resource is isolated, the security team is notified, and a compliance ticket is created -- all simultaneously. The RecordEvidence step at the end ensures every remediation, regardless of severity, produces an audit-ready evidence record.


Config Rules for SageMaker Compliance

AWS Config provides continuous evaluation of your SageMaker resources against compliance rules. These rules run automatically whenever a resource configuration changes.

Key Config rules for AI workloads:

Config Rule What It Checks Compliance Mapping
sagemaker-notebook-instance-kms-key-configured Notebook encryption at rest SOC 2 CC6.7, NIST SC-28
sagemaker-notebook-no-direct-internet-access Notebook network isolation SOC 2 CC6.6, NIST SC-7
sagemaker-endpoint-configuration-kms-key-configured Endpoint encryption SOC 2 CC6.7, NIST SC-28
sagemaker-notebook-instance-root-access-check No root access on notebooks SOC 2 CC6.1, NIST AC-6
Custom: bedrock-guardrail-required Guardrails attached to all models OWASP LLM01, SOC 2 CC6.1
Custom: ml-role-least-privilege No wildcard ML permissions NIST AC-6, SOC 2 CC6.3

Each non-compliant evaluation feeds into EventBridge, which routes to the appropriate remediation Lambda. The Config evaluation history becomes compliance evidence showing continuous monitoring.


Consolidated Compliance Mapping

Compliance Requirement Description EventBridge Pattern
NIST 800-53 IR-4 Incident handling All auto-remediation workflows
NIST 800-53 IR-6 Incident reporting SNS notifications + ticket creation
NIST 800-53 AC-6 Least privilege IAM role auto-restriction
NIST 800-53 SC-28 Information at rest SageMaker encryption enforcement
SOC 2 CC7.1 System monitoring Config rules + EventBridge detection
SOC 2 CC7.2 Security event evaluation EventBridge rule pattern matching
SOC 2 CC7.3 Response to vulnerabilities Lambda/Step Functions remediation
ISO 27001 A.5.24 Incident management End-to-end remediation workflows
ISO 27001 A.8.3 Access restriction Permissions boundary enforcement
ISO 27001 A.8.24 Use of cryptography Encryption-at-rest enforcement

Using Claw GRC for Remediation Tracking

Claw GRC integrates with your EventBridge remediation pipeline to provide end-to-end compliance visibility:

Automated evidence collection:

  • Remediation execution logs from Lambda and Step Functions (real-time)
  • Config rule evaluation history for AI resources (continuous)
  • EventBridge rule invocation metrics from CloudWatch (daily)
  • SNS notification delivery confirmations (per event)

Remediation dashboards:

  • Real-time view of active violations and remediation status
  • Mean time to detect (MTTD) and mean time to respond (MTTR) tracking
  • Remediation success/failure rates by violation type
  • Trend analysis showing compliance posture improvement over time

Audit-ready reporting:

  • Pre-built reports mapping EventBridge patterns to compliance controls
  • Evidence packages for SOC 2 CC7.x (monitoring and response) criteria
  • NIST 800-53 IR family control evidence bundles
  • Exportable remediation logs with timestamps and action details

For the security foundation that feeds these remediation patterns, see AWS Cloud Security for AI Compliance. For the broader governance framework, see the Complete Guide to AWS AI/ML Governance.


Start automating your AI compliance remediation →

CG

Get started with Claw GRC

AI-native compliance automation. 1,026+ controls. MCP-native. Free workspace, no credit card.

Start Free →