Schedule icon
AwsCLI icon
Return icon
If icon
Create icon
SlackIncomingWebhook icon
Log icon

Amazon SNS Subscription Delivery Failure and DLQ Sentinel

Monitor Amazon SNS subscriber notification delivery and DLQ failures with Kestra. Query CloudWatch, open GitHub issues, and alert Slack.

Categories
CloudInfrastructure

Amazon Simple Notification Service (SNS) acts as a high-throughput fan-out messaging hub, pushing events to SQS queues, HTTP/HTTPS webhooks, AWS Lambda functions, and SMS endpoints. When subscriber endpoints fail authentication, time out, or throw 5xx server errors, SNS retries delivery according to its backoff policy before routing poison messages to dead-letter queues (DLQs) or dropping them completely. This blueprint queries Amazon CloudWatch for NumberOfNotificationsFailed on target topics periodically, identifies delivery drops, logs an automated GitHub incident issue, and alerts cloud operations teams via Slack.

How it works

  1. periodic_sns_dlq_check (io.kestra.plugin.core.trigger.Schedule) initiates the audit every 15 minutes (shipped disabled for safe verification).
  2. probe_sns_delivery_metrics (io.kestra.plugin.aws.cli.AwsCLI) queries CloudWatch for NumberOfNotificationsFailed across the previous 15-minute window.
  3. evaluate_failed_notifications (io.kestra.plugin.core.debug.Return) evaluates whether any failed deliveries occurred (has_failures == true).
  4. branch_on_sns_failures (io.kestra.plugin.core.flow.If) evaluates the condition:
    • then: Automatically files a GitHub tracking issue via create_sns_incident_issue (io.kestra.plugin.github.issues.Create) and alerts the Slack channel via alert_cloud_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).
    • else: Emits an informational log entry (log_sns_healthy) confirming 100% delivery success.
  5. log_audit_complete (io.kestra.plugin.core.log.Log) records the final health summary.
  6. The errors block alerts Slack if AWS API calls time out or credentials expire.

What you get

  • Automated, continuous auditing of Amazon SNS subscriber delivery health.
  • Zero silent drops when webhook endpoints or downstream queues fail.
  • Consolidated GitHub incident tickets with topic names, regions, and failed counts.
  • Real-time Slack notifications with direct ticket hyperlinks.

Who it's for

  • Cloud Platform Engineers and SREs maintaining AWS event-driven architectures.
  • Distributed systems developers relying on SNS message fan-out pipelines.
  • DevOps engineers ensuring notification reliability across webhook targets.

Why orchestrate this with Kestra

Kestra simplifies cloud infrastructure reliability by unifying AWS CLI querying, JSON data extraction, conditional escalation, and chat alerting into a single declarative pipeline. It injects IAM credentials securely, provides complete execution history, and eliminates the need for separate standalone monitoring daemons.

Prerequisites

  • An AWS account with an active Amazon SNS topic.
  • An AWS IAM user or role with cloudwatch:GetMetricData permissions.
  • A GitHub Personal Access Token with repository issue creation permissions.
  • A Slack incoming webhook URL for notifications.

Secrets

  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: Credentials with CloudWatch read permissions.
  • GITHUB_TOKEN: GitHub token used to open incident issues.
  • SLACK_WEBHOOK: Incoming Webhook URL for cloud alerts.

Inputs

  • aws_region (STRING, default us-east-1): Target AWS region hosting the SNS topic.
  • topic_name (STRING, default production-security-alerts): Name of the audited SNS topic.
  • target_repository (STRING, default my-org/cloud-operations): Target GitHub repository for logging incident issues.

Outputs

  • outputs.probe_sns_delivery_metrics.vars.MetricDataResults: Raw CloudWatch metric data points.
  • outputs.evaluate_failed_notifications.value.failed_count: Number of failed notifications detected.
  • outputs.evaluate_failed_notifications.value.has_failures: Boolean indicating whether failures occurred.

Quick start

  1. Configure AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN, and SLACK_WEBHOOK in your Kestra namespace.
  2. Import this flow and set topic_name to match an active SNS topic.
  3. Run the flow manually to verify metric retrieval and Slack notification delivery.
  4. Enable the periodic_sns_dlq_check trigger for continuous notification delivery monitoring.

How to extend

  • Add an automated subscription health audit (aws sns list-subscriptions-by-topic) to identify the exact failing subscriber endpoint.
  • Inspect SQS dead-letter queue depth using ApproximateNumberOfMessagesVisible.
  • Route urgent alerts to PagerDuty or Opsgenie if delivery failures exceed 50 messages.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.