Build Notification Pipelines

The Firehose delivers raw notification events to an AWS SNS topic. From there, you build the downstream pipeline that queues, filters, transforms, and routes events to their final destinations: email, ticketing systems, BI dashboards, or any other consumer.

This guide covers architectural patterns and considerations for building robust notification pipelines.

Exploration

Before building a pipeline, familiarize yourself with the volume and rate of change in your environment:

  1. Create a test resource (e.g., an S3 bucket).
  2. Set a policy to enforce on that resource.
  3. Observe the Activity tab for the resource to understand the rate of notifications.
  4. Watch the progression: tbd → skip → alarm → ok.
  5. Make a policy change at a broader scope (folder or regional level) to see how Guardrails handles change at scale.

Sources of High Volume

These events can generate bursts of hundreds or thousands of notifications. Your pipeline must handle them gracefully:

Include some or all of the following capabilities in your pipeline:

Queueing

Buffer incoming notifications to handle high volumes without dropping events. Queues also facilitate troubleshooting and notification examination. SQS is the natural choice when Firehose publishes to SNS.

Time Delay

Guardrails can generate hundreds of alarm controls when a policy changes or resources are created in bulk. A time delay lets you wait for Guardrails to finish processing before sending alerts. Otherwise you'll send "something is wrong" notifications while Guardrails is still actively remediating.

Filter

While Firehose watches provide considerable control over which notifications are sent, your pipeline may need additional filtering, for example, excluding test accounts or specific resource types.

Routing

A router directs events to different destinations based on content. Some notifications go to a data lake, others to end users, others to the ticketing system. Especially important since Guardrails sends all events to a single Firehose SNS topic.

Rate Limiting and Message Aggregation

Prevent notification fatigue by aggregating bursts into summary messages. Instead of 200 emails when a policy changes, send one email explaining what happened. Consider also sending periodic "nothing changed" heartbeat messages to confirm the pipeline is operational.

Data Transformation

Downstream systems may require CSV, YAML, or other formats instead of JSON. A transformation step handles format conversion.

Templating

Raw JSON notifications are not human-readable. A templating step converts events into formatted messages suitable for end users.

Validation

Guardrails can emit transient alarm events that quickly resolve to ok or skip. A validation step queries Guardrails to check "is this control still in alarm?" before sending the notification. This works closely with a time delay to give Guardrails time to finish processing.

Pipeline Instrumentation

Track metrics on notification volume, delivery success/failure, and pipeline health. Someone will want to know when the pipeline is broken.

External Data Lookup

Enrich notifications with data from outside the pipeline: HTTP APIs, SQL databases, local files, or other systems.

Global On/Off Switch

Include an emergency stop that immediately halts all notification delivery.

Scheduled Tasks

Some notifications work best on a periodic interval, such as daily summaries or weekly reports.

Pipeline Heartbeat

Distinguish between "no activity because nothing happened" and "no activity because something is broken upstream."

Gotchas

Volume of Change for Policy Values

Changing policy settings can induce extremely high message volumes for the policy_values notification type. An environment may have a few hundred policy settings but hundreds of thousands of policy values. Ensure your pipeline can handle the burst.

False Positives on Alarms

It's normal for Guardrails to set a control to alarm temporarily when processing a new resource or policy change. Avoid sending "something is wrong" alerts while Guardrails is still remediating. The Time Delay and Validation components described above reduce or eliminate these false positives.

Example Pipelines

Design Requirements

These examples assume:

Pipeline with Different Delay Queues

Requirements: different validation delays for different destinations.

Guardrails → Firehose → SNS → Lambda Subscription → Router (1)(2)(3)
  (1) → Queue (1m delay) → Validation → Rate Limit → Aggregate → Template → Email
  (2) → Queue (10m delay) → Validation → Transform (JSON→CSV) → BI Dashboard
  (3) → Queue (5m delay) → Validation → Data Lookup → Transform (JSON→YAML) → Ticketing

Pipeline with Shared Validation

More efficient when all destinations need validation. Validate once, then route.

Guardrails → Firehose → SNS → SQS Queue (with delay) → Validation → Router (1)(2)(3)
  (1) Rate Limit → Aggregate → Template → Email
  (2) Transform (JSON→CSV) → BI Dashboard
  (3) Data Lookup → Transform (JSON→YAML) → Ticketing

Simple Email Pipeline

Each enforcement action results in one email notification.

Guardrails → Firehose → SNS → SQS Queue (with delay) → Validation → Router
  (1) Rate Limit → Aggregate → Template → Email Address Lookup → Email

Troubleshooting

Check CloudWatch Logs at /aws/lambda/turbot-turbotfirehoseawssnssender-{hash} for publishing errors. These logs cover publishing to the topic only. Activity after the topic is your downstream pipeline's responsibility.

Reference