New to Kestra?
Use blueprints to kickstart your first workflows.
Audits AWS API Gateway stages to detect 5XX server error surges and p99 integration latency breaches, dispatching diagnostic incident alerts to DevOps teams.
Modern cloud architectures rely on AWS API Gateway to route client traffic to Lambda functions, ECS microservices, and VPC internal backends. When downstream services encounter memory pressure, database connection pool exhaustion, or unhandled exceptions, API Gateway responds with HTTP 5XX status codes and surging integration latencies. If undetected, client applications fail silently and service-level objectives (SLOs) degrade. This sentinel interrogates AWS API Gateway and CloudWatch metrics on a scheduled interval, detects 5XX error rate anomalies and p99 latency breaches, and notifies incident engineering teams on Slack with actionable diagnostic commands.
*/15 * * * *) or runs on-demand via manual API triggers.get_rest_apis) to discover all active regional APIs matching the configured name filter.Count, 5XXError, and IntegrationLatency across a 15-minute rolling window.io.kestra.plugin.core.flow.If task evaluates whether any API stage exceeds the error rate or latency threshold.#devops-incidents channel with API identifiers, request counts, and CLI diagnosis commands.flowchart TD
A[scheduled_apigateway_audit Schedule Trigger] --> B[scan_apigateway_telemetry Python Script]
B --> C[check_degraded_api_routes Flowable If]
C -- Degraded APIs Detected --> D[notify_slack_api_incident Webhook]
C -- All APIs Healthy --> E[log_telemetry_status Log]
D --> E
E --> F[export_audit_manifest Return]
| Name | Type | Default | Description |
|---|---|---|---|
aws_region |
STRING |
us-east-1 |
Target AWS region where API Gateway instances and CloudWatch metrics reside. |
api_name_filter |
STRING |
all |
Name or prefix of target API Gateway APIs to audit, or all to scan all regional APIs. |
error_5xx_rate_threshold_percent |
FLOAT |
2.0 |
Percentage threshold of 5XX responses relative to total requests that triggers incident alerting. |
p99_latency_threshold_ms |
INT |
1500 |
Maximum allowable p99 integration latency in milliseconds before flagging degraded performance. |
alert_on_degraded |
BOOL |
true |
Whether to dispatch automated Slack incident notifications when threshold breaches are detected. |
{{ outputs.scan_apigateway_telemetry.vars.total_apis_audited }}: Total number of API Gateway APIs evaluated during the execution.{{ outputs.scan_apigateway_telemetry.vars.degraded_apis_count }}: Number of API stages exceeding error rate or latency thresholds.{{ outputs.scan_apigateway_telemetry.vars.degraded_apis_details }}: JSON string listing degraded APIs with exact error rates and latency percentiles.{{ outputs.export_audit_manifest.value }}: Structured dictionary containing the consolidated audit summary.apigateway:GET and cloudwatch:GetMetricData permissions.AWS_ACCESS_KEY_ID: AWS IAM access key with permissions to read API Gateway and CloudWatch metrics.AWS_SECRET_ACCESS_KEY: AWS IAM secret key corresponding to the access key.SLACK_WEBHOOK_URL: Slack Incoming Webhook URL used to dispatch incident notifications.AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK_URL in your Kestra secret storage.company.cloud namespace.aws_region and api_name_filter to target your production API stages.cloudwatch:GetMetricData across AWS/ApiGateway namespaces; missing permissions yield empty metric arrays.