Real-Time Events
Guardrails needs to know when resources change in your AWS accounts so it can update the CMDB, evaluate controls, and take enforcement actions. There are three mechanisms for delivering these change notifications. You choose one for each account.
Choosing the Right Mechanism
| Event Poller | Global Event Handlers | Regional Event Handlers | |
|---|---|---|---|
| How it works | Guardrails periodically queries CloudTrail for recent API events. | EventBridge rules in each region forward events to a single primary region, which delivers them to Guardrails via SNS. | EventBridge rules, SNS topics, and subscriptions are deployed independently in every active region. |
| Latency | 1–10 minutes (configurable polling interval). | Near real-time (seconds). | Near real-time (seconds). |
| Scalability | Limited. CloudTrail LookupEvents API has strict rate limits that become a bottleneck in large, busy environments. | Excellent. EventBridge handles high event volumes natively. Centralized in one region reduces resource sprawl. | Good. EventBridge handles high volume, but requires per-region infrastructure. |
| AWS infrastructure | None. Guardrails uses existing CloudTrail data via API. | EventBridge rules in each region, one SNS topic in the primary region, one cross-region IAM role. | EventBridge rules + SNS topics + subscriptions in every region. |
| Setup complexity | Lowest. Enable a policy, no AWS resources needed. | Moderate. Requires an IAM role for cross-region event forwarding. | Highest. Guardrails deploys infrastructure in every enabled region via Terraform. |
| Recommended for | Development environments, POCs, accounts with very low activity. | Production environments. The recommended mechanism for all accounts. | Legacy environments that haven't migrated yet. |
| Status | Active (default for new accounts). | Preferred. | Superseded by Global Event Handlers. |
How They Relate
These three mechanisms are mutually exclusive. You should only have one active at a time for each account. If you enable event handlers (global or regional), disable the event poller to avoid duplicate processing and unnecessary API calls.
The typical progression is:
- Start with the Event Poller: enabled by default when you connect an account. Works immediately with no setup.
- Upgrade to Global Event Handlers: when you're ready for production-grade real-time events. This is the recommended configuration.
- Migrate from Regional Event Handlers: if you have legacy regional handlers, migrate them to global for cost and operational benefits.
CloudTrail Dependency
All three mechanisms depend on AWS CloudTrail being active in your accounts. CloudTrail records API activity that Guardrails uses to detect resource changes.
- Event Poller: Directly queries the CloudTrail
LookupEventsAPI. - Event Handlers (global and regional): CloudTrail feeds events into EventBridge, which routes them to Guardrails via SNS.
If CloudTrail is not configured, Guardrails can still discover resources through periodic CMDB polling, but will miss real-time changes.
Guides
| Guide | Description |
|---|---|
| Event Poller | Configure polling frequency and window. |
| Event Handlers | Shared concepts: required mods, CloudTrail, workspace policies, how event handlers work. |
| Global Event Handlers | Set up the recommended real-time event delivery. |
| Regional Event Handlers | Configure legacy per-region event handlers. |
| Migrate to Global Event Handlers | Move from regional to global event handlers. |