New to Kestra?
Use blueprints to kickstart your first workflows.
Monitor Snowflake warehouse credit consumption and prevent runaway cloud billing with Kestra. Query ACCOUNT_USAGE, track GitHub issues, and notify Slack.
Cloud data warehouses like Snowflake offer elastic scaling, but unoptimized queries, runaway ETL jobs, or excessive auto-suspend timeouts can rapidly burn through expensive credit allocations. Without automated governance, data platform leaders only discover credit spikes on the monthly invoice. This blueprint interrogates Snowflake's ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY hourly, detects credit consumption spikes breaching predefined thresholds, logs an auditable GitHub FinOps ticket, and notifies data platform engineers on Slack.
hourly_warehouse_governance_check (io.kestra.plugin.core.trigger.Schedule) initiates the audit every hour (shipped disabled for safe verification).probe_warehouse_credit_usage (io.kestra.plugin.jdbc.snowflake.Query) queries the Snowflake ACCOUNT_USAGE.WAREHOUSE_METERING_HISTORY view via JDBC for credits consumed across compute and cloud services in the preceding hour.evaluate_credit_surge (io.kestra.plugin.core.debug.Return) calculates if total credit consumption breached the hourly threshold.branch_on_credit_surge (io.kestra.plugin.core.flow.If) evaluates the condition:then: Automatically files a GitHub tracking issue via create_finops_github_issue (io.kestra.plugin.github.issues.Create) and alerts the Slack channel via alert_finops_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook).else: Emits an informational log entry (log_warehouse_compliant) confirming normal credit usage.log_audit_summary (io.kestra.plugin.core.log.Log) records the audit outcome.errors block alerts Slack if Snowflake JDBC connection fails or credentials expire.Kestra simplifies multi-system governance by connecting Snowflake JDBC querying, conditional thresholding, GitHub issue management, and Slack alerting into a single declarative pipeline. It handles secrets securely, provides complete execution history, and eliminates the need for external Lambda functions or custom cron wrappers.
SNOWFLAKE.ACCOUNT_USAGE schema.SNOWFLAKE_ACCOUNT: Snowflake account locator or organization identifier.SNOWFLAKE_USERNAME, SNOWFLAKE_PASSWORD: Credentials for Snowflake authentication.GITHUB_TOKEN: GitHub token used to open FinOps issues.SLACK_WEBHOOK: Slack Incoming Webhook URL for alerting.warehouse_name (STRING, default COMPUTE_WH): Name of the Snowflake virtual warehouse to audit.credit_threshold (FLOAT, default 15.0): Maximum tolerated hourly credit consumption before alerting.github_repository (STRING, default my-org/snowflake-cost-governance): Target GitHub repository for logging FinOps issues.outputs.probe_warehouse_credit_usage.row: Aggregated credit metrics row returned by Snowflake.outputs.evaluate_credit_surge.value: Extracted evaluation object with credit breakdowns and surge boolean flag.SNOWFLAKE_ACCOUNT, SNOWFLAKE_USERNAME, SNOWFLAKE_PASSWORD, GITHUB_TOKEN, and SLACK_WEBHOOK secrets.warehouse_name to match an active Snowflake warehouse.hourly_warehouse_governance_check trigger for continuous automated FinOps monitoring.ALTER WAREHOUSE SUSPEND statement gated behind manual approval to immediately halt runaway warehouses.QUERY_HISTORY to automatically identify the specific queries that consumed the most credits.