API Reliability Monitor with Kestra
Monitor an HTTP endpoint, detect unexpected status codes, and generate structured health events.
Monitor AWS WAFv2 web ACL capacity (WCUs) and alert Slack before the cost tier or fixed quota is exceeded.
Every AWS WAFv2 web ACL has a fixed, non-adjustable 5,000 Web ACL
Capacity Unit (WCU) ceiling, and a lower 1,500 WCU base-price ceiling
beyond which AWS bills extra per WCU. Neither limit shows up anywhere
until a CreateWebACL or UpdateWebACL call to add one more rule fails
outright, often discovered for the first time while a team is actively
trying to add a rule to block an ongoing attack. This blueprint reads
the web ACL's current consumed capacity on a schedule and alerts Slack
well before either threshold is crossed.
periodic_capacity_check (io.kestra.plugin.core.trigger.Schedule) runs every 30 minutes, explicitly passing aws_region, web_acl_name, web_acl_id, scope, cost_tier_threshold, and critical_threshold through its own inputs: block so the flow is self-contained when the trigger fires. Shipped disabled so a manual run can be verified first.probe_web_acl_capacity (io.kestra.plugin.aws.cli.AwsCLI) runs aws wafv2 get-web-acl --query 'WebACL.Capacity' --output text, extracting just the consumed-WCU scalar rather than the full web ACL JSON, guarding against an empty or non-numeric result, and emitting it as the named output capacity.evaluate_capacity_tier (io.kestra.plugin.core.flow.If) branches into three states via nesting:Capacity at or above critical_threshold (default 4,500, 90% of the fixed 5,000 WCU hard cap) - alert_capacity_critical fires.Capacity at or above cost_tier_threshold (default 1,500, AWS's own base-price ceiling) but below critical - alert_cost_tier_exceeded fires.log_capacity_healthy records the pass.log_audit_complete always runs last, printing the final Capacity regardless of which branch fired.errors block alerts Slack separately if the flow itself fails outright - a web ACL name/id/scope combination that does not exist, or invalid credentials.Capacity field, not from counting rules or summing estimated WCU costs client-side.io.kestra.plugin.aws.cli.AwsCLI on wafv2 get-web-acl, with no prior blueprint coverage of this plugin surface in this repository.AwsCLI reading a quota/capacity value that has no dedicated Kestra task and no CloudWatch metric equivalent.AWS WAF has no built-in "alert me before I hit my WCU cap" primitive - CloudWatch WAF metrics track request counts and rule matches, not capacity consumption, and the only native signal is the error returned by the next UpdateWebACL call. Kestra supplies the schedule, the HEALTHY/COST_TIER_EXCEEDED/CAPACITY_CRITICAL classification as a first-class three-way branch, and an execution history showing exactly when capacity crossed each threshold.
web_acl_name, web_acl_id, scope, aws_region).wafv2:GetWebACL permission - entirely read-only, cannot modify any rule or association.AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY: credentials for io.kestra.plugin.aws.cli.AwsCLI.SLACK_WEBHOOK_URL: Slack incoming webhook used by both alert branches and the errors block.SECRET_, base64-encoded - for example SECRET_AWS_SECRET_ACCESS_KEY=$(echo -n '<your-secret-key>' | base64) - and read back in flows with {{ secret('NAME') }}.aws_region (STRING, default us-east-1): region for the AWS CLI call (REGIONAL scope); CLOUDFRONT scope always uses us-east-1.web_acl_name / web_acl_id (STRING, required, no default - a placeholder cannot satisfy their validator regexes): identify the target web ACL; find the ID via aws wafv2 list-web-acls or the console.scope (SELECT, default REGIONAL): REGIONAL or CLOUDFRONT.cost_tier_threshold (INT, default 1500): AWS's own documented base-price WCU ceiling.critical_threshold (INT, default 4500): 90% of AWS's fixed 5,000 WCU hard cap.outputs.probe_web_acl_capacity.vars.capacity (Integer): consumed WCUs, extracted via --query 'WebACL.Capacity' --output text from get-web-acl's own documented output schema. This is the only output field this task captures - the full WebACL object (Name, Id, ARN, Rules, etc.) is not fetched or stored.aws wafv2 list-web-acls --scope REGIONAL).AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and SLACK_WEBHOOK_URL secrets.log_capacity_healthy fires if the ACL is comfortably under 1,500 WCUs.cost_tier_threshold below the ACL's real Capacity and re-run to confirm alert_cost_tier_exceeded fires; lower critical_threshold the same way to confirm alert_capacity_critical fires.periodic_capacity_check once you trust the check against your real web ACL.web_acl_name/web_acl_id/scope combinations with io.kestra.plugin.core.flow.Loop to audit every web ACL in an account in one run.aws wafv2 list-web-acls task to resolve web_acl_id automatically from web_acl_name, removing the need to look the ID up manually - kept out of this sentinel to avoid an extra layer of client-side string matching between two AWS CLI calls.AwsCLI task calling get-web-acl without the --query filter, to post the web ACL's full Rules list to Slack alongside the alert, so the team can immediately see which rule is the largest WCU consumer and a candidate for trimming.CAPACITY_CRITICAL as the urgent signal and COST_TIER_EXCEEDED as the lower-urgency one.get-web-acl requires the exact web_acl_id, not just the name - two web ACLs with different IDs can share a display name across scopes or accounts, so this blueprint cannot resolve the ID for you; look it up with list-web-acls first.us-east-1 regardless of the aws_region input - this blueprint switches the AWS CLI call to us-east-1 automatically when scope is CLOUDFRONT, because the CLI requires that region for CloudFront-scope web ACLs.