Global Event Handlers

Global Event Handlers (GEH) are the recommended mechanism for real-time AWS event delivery. They consolidate event handling into a single primary region. EventBridge rules in each region forward events to the primary region, where they're delivered to Guardrails via SNS.

Compared to regional event handlers, GEH requires fewer AWS resources (one SNS topic instead of one per region), reduces costs, and simplifies operations while maintaining full coverage across all regions.

Prerequisites

Infrastructure

GEH deploys different resources in the primary region vs secondary regions:

ComponentPrimary RegionSecondary Regions
EventBridge rulesMatches CloudTrail events, routes to SNS topicMatches CloudTrail events, forwards to primary region event bus
EventBridge targetsSNS topicPrimary region's default event bus
SNS topicReceives events from all regionsNone
SNS subscriptionHTTPS delivery to Guardrails webhookNone
Cross-region IAM roleOne per account, allows secondary regions to put events on the primary event busNone (uses the same role)

The primary region defaults to us-east-1 for the commercial partition. Change it via the AWS > Turbot > Event Handlers [Global] > Primary Region policy.

How It Works

GEH centralizes event delivery through cross-region forwarding:

  1. CloudTrail records API activity in each region.
  2. EventBridge rules in each region match relevant CloudTrail events.
  3. In secondary regions, matched events are forwarded to the primary region's event bus using the cross-region IAM role.
  4. In the primary region, an EventBridge rule routes all matched events to the SNS topic.
  5. The SNS subscription delivers events via HTTPS to the Guardrails webhook.

For the full event flow path (including Enterprise API Gateway) and details on how Guardrails compiles Terraform from workspace policies, installed mods, and CMDB settings, see How Event Handlers Work.

Step 1: Enable Service Roles

Global Event Handlers require a cross-region IAM role for EventBridge forwarding. You can let Guardrails manage this role automatically or create it manually.

Create a policy setting for AWS > Turbot > Service Roles and set it to Enforce: Configured. Set the resource to Turbot (workspace root) to apply to all accounts.

This creates a service role in each account that EventBridge uses to forward events from secondary regions to the primary region's event bus.

Wait for all AWS > Turbot > Service Roles controls across your accounts to reach ok state.

Option B: Custom IAM Role

If your organization requires manual IAM role creation (e.g., for compliance reasons), create a role in each account with:

Trust policy. Allow EventBridge to assume the role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "events.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

Permissions policy. Allow PutEvents to the primary region event bus:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "events:PutEvents",
      "Resource": "arn:aws:events:us-east-1:ACCOUNT_ID:event-bus/default"
    }
  ]
}

Then set the AWS > Turbot > Event Handlers [Global] > Events > Target > IAM Role ARN policy to the ARN of this role.

Calculated Policy for Dynamic IAM Role ARN

If you have many accounts, use a calculated policy to dynamically look up the role ARN in each account rather than setting it statically:

resource "turbot_policy_setting" "geh_iam_role_arn" {
  resource       = "RESOURCE_ID"
  type           = "tmod:@turbot/aws#/policy/types/eventHandlersGlobalEventsTargetIamRoleArn"
  template_input = <<-EOT
    {
      account {
        event_bridge_role: children(filter:"$.RoleName:turbot_guardrails_events_role resourceTypeId:tmod:@turbot/aws-iam#/resource/types/role level:self") {
          role: items {
            akas
          }
        }
      }
    }
  EOT
  template = <<-EOT
    {%- if $.account.event_bridge_role.role | length == 1 -%}
    {{ $.account.event_bridge_role.role[0].akas[0] }}
    {%- else -%}
    "missing or too many eventbridge roles"
    {%- endif -%}
  EOT
}

This queries for a role named turbot_guardrails_events_role in each account and returns its ARN. If the role is missing or duplicated, the GEH control will go into error state because the ARN isn't well-formed, making the problem visible immediately.

Step 2: Enable Global Event Handlers

Create a policy setting for AWS > Turbot > Event Handlers [Global] and set it to Enforce: Configured. Set the resource to Turbot (workspace root) to enable across all accounts.

[!IMPORTANT] If you are migrating from regional event handlers, see Migrate to Global Event Handlers for the correct order of operations. You must deploy GEH before decommissioning REH to avoid gaps in event coverage.

Step 3: Disable the Event Poller

If the Event Poller was previously enabled, set AWS > Turbot > Event Poller to Disabled. Only one event mechanism should be active per account. See How They Relate.

Step 4: Verify

  1. Check that all AWS > Turbot > Event Handlers [Global] controls are in ok state. Navigate to Controls and filter by control type AWS > Turbot > Event Handlers [Global].

  2. Test in the primary region: Create a resource (e.g., an S3 bucket) in the primary region and verify that Guardrails detects it within seconds.

  3. Test in a secondary region: Create a resource in a different region and verify detection. This confirms cross-region forwarding is working.

Configuration Policies

PolicyDescriptionDefault
AWS > Turbot > Event Handlers [Global]Enable or disable GEH.Skip
AWS > Turbot > Event Handlers [Global] > Primary RegionThe region that aggregates events from all other regions.us-east-1
AWS > Turbot > Event Handlers [Global] > Events > Target > IAM Role ARNARN of the cross-region forwarding IAM role.Auto-detected from service roles.
AWS > Turbot > Event Handlers [Global] > SNS > Topic > Name PrefixPrefix for the SNS topic name.turbot_
AWS > Turbot > Event Handlers [Global] > SNS > Topic > Customer Managed KeyOptional KMS key for SNS encryption.None
AWS > Turbot > Event Handlers [Global] > Events > Rules > Name PrefixPrefix for EventBridge rule names.turbot_aws_api_events
AWS > Turbot > Service RolesManage the EventBridge cross-region IAM role.Skip

Decommissioning Global Event Handlers

Set AWS > Turbot > Event Handlers [Global] to Enforce: Not configured. Guardrails runs Terraform to destroy the GEH infrastructure in all accounts.

[!IMPORTANT] Deleting an AWS account from Guardrails does not automatically decommission event handlers. You must explicitly set the policy to Enforce: Not configured first.

Decommission event handlers before:

Troubleshooting

For errors related to CloudTrail configuration, workspace policies, or bulk change behavior, see the shared Event Handlers page.

IssueSolution
GEH controls in error stateCheck the Guardrails IAM role has permissions for EventBridge rules and SNS topics. Verify no SCPs are blocking these actions. Check the control logs for specific errors.
Events detected in primary region but not secondaryVerify the cross-region IAM role exists and has events:PutEvents permission. Check that AWS > Turbot > Service Roles controls are in ok.
Events not detected at allVerify CloudTrail is active. Check the SNS subscription is confirmed. Verify the Guardrails webhook URL is reachable. For Enterprise, check the API Gateway configuration.
Duplicate eventsEnsure only one mechanism is active. Disable the Event Poller and regional Event Handlers if GEH is enabled.
Access Denied errorsCheck for SCPs restricting EventBridge or SNS actions. Update AWS > Account > Regions to match permitted regions.
Required mods missingVerify all required mods are installed and in ok state.
Further assistanceOpen a Support Ticket