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

AWS Lambda IteratorAge Stream Processing Lag Sentinel

Monitor AWS Lambda stream processing latency and IteratorAge with Kestra. Query CloudWatch, file GitHub issues, and alert Slack.

Categories
CloudInfrastructure

Serverless architectures frequently stream events from Amazon Kinesis Data Streams or DynamoDB Streams into AWS Lambda functions. When incoming event volume exceeds function concurrency, batch processing times out, or unhandled exceptions trigger retries, the Lambda IteratorAge surges, indicating stream processing lag. This blueprint monitors CloudWatch IteratorAge metrics, identifies stream processing delays, files a GitHub incident ticket, and alerts engineering teams via Slack.

How it works

  1. periodic_iterator_age_check runs every 15 minutes.
  2. probe_iterator_age_metric queries CloudWatch for Maximum IteratorAge.
  3. evaluate_stream_lag evaluates if lag exceeds threshold.
  4. branch_on_stream_lag 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

  • Automated monitoring of serverless stream lag.
  • Early warning before stream retention expires and records are dropped.
  • Consolidated GitHub incident tickets with function metrics.
  • Real-time Slack notifications.

Who it's for

  • Serverless Platform Engineers maintaining event-driven Lambda architectures.
  • Data Engineers processing streaming pipelines via Kinesis and DynamoDB.
  • SREs safeguarding real-time stream SLAs.

Why orchestrate this with Kestra

Kestra provides declarative automation connecting CloudWatch metrics, conditional evaluation, and chat notifications in a single auditable flow.

Prerequisites

  • An AWS account with an active Lambda function.
  • 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.
  • function_name: Lambda function name.
  • iterator_age_ms_threshold: Max age before alerting.
  • target_repository: GitHub repository.

Outputs

  • outputs.evaluate_stream_lag.value.max_iterator_age_ms: Maximum IteratorAge.
  • outputs.evaluate_stream_lag.value.is_lag_critical: Boolean breach flag.

Quick start

  1. Configure secrets.
  2. Set inputs to match target Lambda function.
  3. Run manually to verify metric retrieval.
  4. Enable schedule trigger.

How to extend

  • Add automated shard splitting or concurrent batch scaling tasks.
  • Route urgent alerts to PagerDuty.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.