New to Kestra?
Use blueprints to kickstart your first workflows.
Automated FinOps workflow to audit Snowflake warehouse metering history, detect credit usage spikes over rolling baselines, and alert Slack.
Cloud data warehouses like Snowflake offer elastic scalability, but unmonitored compute can quickly trigger runaway costs. A single unpartitioned cross-join, accidental warehouse size upgrade, or runaway automated clustering job can result in thousands of dollars in surprise cloud bills.
This blueprint implements an automated FinOps guardrail for Snowflake data platforms. Every morning, it queries SNOWFLAKE.ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY, calculates yesterday's credit burn against a rolling 7-day historical baseline for every warehouse, flags percentage spikes exceeding your configured threshold, and immediately alerts your FinOps team on Slack with estimated dollar impacts.
daily_finops_schedule trigger (io.kestra.plugin.core.trigger.Schedule) fires automatically at 07:00 UTC once the previous day's metering history is finalized in Snowflake.calculate_baseline_and_spikes task (io.kestra.plugin.jdbc.snowflake.Query) uses a SQL Common Table Expression (CTE) to aggregate credit usage per warehouse and calculate percentage deviation against the historical rolling window. With fetchType: FETCH, rows are returned to the flow execution context.evaluate_spend_anomalies flowable task (io.kestra.plugin.core.flow.If) evaluates whether the highest-spiking warehouse exceeds alert_threshold_percent.notify_finops_alert (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) dispatches a high-priority alert card detailing the offending warehouse, yesterday's credits, historical baseline, and dollar estimates.export_finops_audit task records execution audit details for compliance logs and data platform dashboards.Snowflake includes basic resource monitors, but they only support hard quota cutoffs that abruptly terminate running production queries. Kestra provides declarative, intelligent FinOps automation: it computes statistical rolling baselines, sends rich formatted Slack digests, maintains execution lineage, and can conditionally trigger downstream mitigation workflows without disrupting production workloads.
| Name | Type | Default | Description |
|---|---|---|---|
alert_threshold_percent |
FLOAT | 50.0 |
Cost spike threshold percentage above rolling 7-day baseline to trigger a Slack alert. |
baseline_days |
INT | 7 |
Historical rolling evaluation window in days to compute daily average spend. |
estimated_credit_price_usd |
FLOAT | 3.00 |
Estimated dollar cost per Snowflake credit (standard Enterprise pricing). |
slack_channel |
STRING | #finops-alerts |
Destination Slack channel for anomaly alert dispatch. |
{{ outputs.calculate_baseline_and_spikes.rows }}: Array of warehouse usage records containing warehouse_name, credits_yesterday, baseline_credits, estimated_cost_usd, and spike_percentage.{{ outputs.calculate_baseline_and_spikes.size }}: Total number of active warehouses analyzed.{{ outputs.evaluate_spend_anomalies }}: Result of conditional branch checking if top warehouse spike exceeded threshold.{{ outputs.export_finops_audit.value }}: Structured JSON manifest recording execution timestamp, top warehouse name, spike percentage, and anomaly flag.SNOWFLAKE.ACCOUNT_USAGE views (typically granted to ACCOUNTADMIN or via custom monitoring role).SNOWFLAKE_JDBC_URL: Snowflake JDBC connection string (e.g. jdbc:snowflake://<account_identifier>.snowflakecomputing.com?warehouse=COMPUTE_WH&db=SNOWFLAKE&schema=ACCOUNT_USAGE).SNOWFLAKE_USER: Username of the service account authorized to query account usage.SNOWFLAKE_PASSWORD: Password for the Snowflake service account.SLACK_WEBHOOK_URL: Slack Incoming Webhook endpoint URL used for sending alert notifications.ACCOUNT_USAGE views have an inherent data latency of approximately 45 to 120 minutes. Running the schedule at 07:00 UTC ensures full reconciliation of the prior calendar day's usage.IMPORTED PRIVILEGES on database SNOWFLAKE to read ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY.SNOWFLAKE_JDBC_URL uses hyphens rather than underscores if your account uses cloud locator syntax (e.g., xy12345.us-east-2.aws).io.kestra.plugin.notifications.mail.MailSend inside the then: block to notify finance department heads via email.ALTER WAREHOUSE ... SET WAREHOUSE_SIZE = 'X-SMALL'.