New to Kestra?
Use blueprints to kickstart your first workflows.
Monitor Amazon RDS database connection spikes and pool exhaustion with Kestra. Query CloudWatch metrics, open GitHub DBA issues, and notify Slack.
Diagram unavailable
We could not build the topology for this blueprint. The flow itself is valid, use the YAML on the left to run it.
Relational databases in production environments can experience sudden connection spikes due to application thread pool leaks, traffic surges, or cascading query deadlocks. When connection pools exhaust available instance capacity (max_connections), incoming client requests are refused, causing cascading service outages. This blueprint queries Amazon CloudWatch for RDS DatabaseConnections metrics on a regular cadence, identifies headroom breaches, automatically logs a prioritized GitHub DBA investigation ticket, and alerts database engineers on Slack.
periodic_database_health_check (io.kestra.plugin.core.trigger.Schedule) initiates the check periodically (shipped disabled for safe manual validation).probe_rds_metrics (io.kestra.plugin.aws.cli.AwsCLI) queries Amazon CloudWatch metrics (AWS/RDS -> DatabaseConnections) for the peak connection count across the last 15 minutes.evaluate_connection_headroom (io.kestra.plugin.core.debug.Return) calculates whether maximum connections breached the operator-defined threshold.branch_on_connection_spike (io.kestra.plugin.core.flow.If) evaluates the headroom condition:then: Automatically files a GitHub tracking issue via create_dba_incident_issue (io.kestra.plugin.github.issues.Create) and alerts the DBA Slack channel via alert_dba_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).else: Logs a clean status message (log_database_healthy) confirming normal operational load.log_audit_complete (io.kestra.plugin.core.log.Log) records the final connection summary for observability.errors block alerts Slack if AWS credentials or CloudWatch API calls fail.Kestra unifies AWS metric polling, conditional logic, GitHub issue creation, and Slack notifications into a single auditable workflow. It securely injects AWS credentials, handles transient network retries, and eliminates the need for separate standalone alerting lambdas or fragmented monitoring scripts.
cloudwatch:GetMetricData permission.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY: AWS credentials with CloudWatch read permissions.GITHUB_TOKEN: GitHub token used to open database investigation issues.SLACK_WEBHOOK: Slack Incoming Webhook URL for DBA alerts.aws_region (STRING, default us-east-1): Target AWS region hosting the RDS database.db_instance_identifier (STRING, default production-postgres-cluster): Name or identifier of the RDS instance to monitor.connection_threshold (INT, default 250): Maximum tolerated connections before alerting.github_repository (STRING, default my-org/database-operations): Target GitHub repository for logging incident issues.outputs.probe_rds_metrics.vars.MetricDataResults: Raw CloudWatch metric data points.outputs.evaluate_connection_headroom.value: Extracted metric evaluation containing max_connections, threshold, and is_exhausted.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, GITHUB_TOKEN, and SLACK_WEBHOOK in your Kestra namespace.db_instance_identifier to match your target RDS database.periodic_database_health_check trigger for continuous headroom monitoring.