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

Amazon SQS Message Age and Consumer Processing Lag Sentinel

Monitor Amazon SQS message age and consumer lag with Kestra. Query CloudWatch metrics, open GitHub issues, and alert Slack.

Categories
CloudInfrastructure

Asynchronous event-driven architectures rely on Amazon SQS queues to decouple producers from background processing consumers. When consumer pods crash, encounter database deadlock stalls, or scale insufficiently during traffic spikes, messages accumulate and age in the queue. This blueprint monitors CloudWatch ApproximateAgeOfOldestMessage metrics, detects SLA breaches, opens an automated GitHub tracking ticket, and alerts the messaging team on Slack.

How it works

  1. periodic_sqs_age_check runs every 15 minutes.
  2. probe_sqs_age_metric queries CloudWatch for Maximum ApproximateAgeOfOldestMessage.
  3. evaluate_message_age evaluates if age exceeds SLA threshold.
  4. branch_on_age_breach logs a GitHub issue and alerts Slack if breached.
  5. log_audit_complete logs final outcome.
  6. errors block alerts Slack on execution failure.

What you get

  • Continuous auditing of message processing latency.
  • Early warning before customer-facing SLA breaches.
  • Automated GitHub tracking tickets with queue metrics.
  • Real-time Slack notifications.

Who it's for

  • Platform Engineers and SREs maintaining AWS messaging queues.
  • Backend developers operating asynchronous task consumers.
  • Operations teams tracking processing SLAs.

Why orchestrate this with Kestra

Kestra unifies AWS CloudWatch querying, conditional escalation, and chat notifications in a single auditable workflow.

Prerequisites

  • An AWS account with an active SQS queue.
  • AWS IAM credentials with CloudWatch read permissions.
  • A GitHub Personal Access Token.
  • A Slack incoming webhook URL.

Secrets

  • AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: AWS credentials.
  • GITHUB_TOKEN: GitHub token.
  • SLACK_WEBHOOK: Slack webhook URL.

Inputs

  • aws_region: Target region.
  • queue_name: SQS queue name.
  • max_age_seconds_threshold: Max age before alerting.
  • target_repository: GitHub repository.

Outputs

  • outputs.evaluate_message_age.value.oldest_age_seconds: Age of oldest message.
  • outputs.evaluate_message_age.value.is_sla_breached: Boolean breach flag.

Quick start

  1. Configure secrets.
  2. Set inputs to match target SQS queue.
  3. Execute manually to verify metrics.
  4. Enable schedule trigger.

How to extend

  • Add AWS Auto Scaling tasks to spin up additional consumer worker instances.
  • Route urgent alerts to PagerDuty.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.