Alert on nginx 5xx Error Rate
Ten-minute 5xx rate check over the nginx access log that alerts Slack on spikes.
Audits AWS Cognito User Pools for abandoned unconfirmed user registrations, generating cleanup reports and security digests for IAM teams via Slack.
Modern SaaS applications and consumer mobile portals use Amazon Cognito User Pools for customer identity, registration workflows, and self-service password recovery. During public signups, users create accounts and receive one-time SMS or email verification codes. However, a significant fraction of registrations are abandoned by users who mistype their emails or by automated bot registration scripts probing signup endpoints. Over time, these stale accounts remain indefinitely in the UNCONFIRMED state, polluting user directories, inflating Monthly Active User (MAU) analytics, and preventing legitimate users from reusing orphaned usernames. This sentinel scans the target Cognito User Pool on a weekly schedule, detects unconfirmed accounts older than the retention threshold (e.g. 7 days), and dispatches a structured cleanup digest to IAM operations teams on Slack.
0 8 * * 1) or runs on-demand via manual execution.ListUsers) using server-side filtering for cognito:user_status = "UNCONFIRMED".UserCreateDate timestamp of each unconfirmed account relative to current UTC time.max_unconfirmed_age_days and compiles an actionable pruning manifest.io.kestra.plugin.core.flow.If flowable checks if stale accounts exist and sends a cleanup summary to #iam-security-alerts.flowchart TD
A[weekly_cognito_hygiene_audit Schedule Trigger] --> B[scan_unconfirmed_users Python Script]
B --> C[check_unconfirmed_backlog Flowable If]
C -- Stale Accounts Found --> D[notify_slack_stale_accounts Webhook]
C -- Directory Clean --> E[log_hygiene_status Log]
D --> E
E --> F[export_cognito_manifest Return]
Cognito User Pools do not natively feature automatic time-to-live (TTL) expiration for unconfirmed user accounts. Without programmatic intervention, unconfirmed accounts persist forever. Kestra provides scheduled orchestration with native container isolation, secret management for AWS IAM credentials, and direct Slack integration. Using Kestra, platform teams automate identity hygiene workflows safely without writing and managing bespoke Lambda cron functions.
| Name | Type | Default | Description |
|---|---|---|---|
aws_region |
STRING |
us-east-1 |
Target AWS region where the Cognito User Pool is hosted. |
user_pool_id |
STRING |
us-east-1_abcdef123 |
Unique identifier of the target AWS Cognito User Pool to audit. |
max_unconfirmed_age_days |
INT |
7 |
Threshold in days beyond which unconfirmed accounts are considered abandoned candidates for pruning. |
alert_on_stale_accounts |
BOOL |
true |
Whether to dispatch automated Slack digests when abandoned unconfirmed users are identified. |
{{ outputs.scan_unconfirmed_users.vars.user_pool_id }}: Identifier of the evaluated Cognito User Pool.{{ outputs.scan_unconfirmed_users.vars.stale_count }}: Number of unconfirmed accounts exceeding the age threshold.{{ outputs.scan_unconfirmed_users.vars.has_stale_accounts }}: Boolean flag indicating whether stale registrations were discovered.{{ outputs.export_cognito_manifest.value }}: Structured dictionary containing the consolidated cleanup manifest.cognito-idp:ListUsers permissions.AWS_ACCESS_KEY_ID: AWS IAM access key with permissions to inspect Cognito user pools.AWS_SECRET_ACCESS_KEY: AWS IAM secret key corresponding to the access key.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch IAM cleanup alerts.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK_URL in your Kestra secret storage.company.cloud namespace.user_pool_id with your Cognito User Pool ID.ListUsers API returns up to 60 users per page; using Boto3's paginator ensures large directories are scanned completely.cognito-idp:ListUsers; missing permissions result in AccessDeniedException.cognito:user_status = "UNCONFIRMED" requires exact double quotes inside the filter expression.cognito-idp:AdminDeleteUser to automatically prune stale accounts older than 30 days after human approval.io.kestra.plugin.email.Send.io.kestra.plugin.core.flow.ForEach loop to audit all customer and employee user pools in the account.