New to Kestra?
Use blueprints to kickstart your first workflows.
Automated FinOps workflow to query Snowflake table storage metrics, detect runaway Time Travel and Fail-safe costs, and alert Slack.
In Snowflake cloud data warehouses, physical storage costs encompass three distinct layers: active data bytes, Time Travel retention bytes, and 7-day Fail-safe protection bytes. For high-churn ETL staging tables, scratch tables, or daily full-refresh data pipelines, default 90-day retention policies cause historical versions and fail-safe copies to swell to 5x to 10x the size of the underlying active table.
Organizations often incur thousands of dollars in monthly cloud storage fees for unneeded historical snapshots of temporary tables that are completely overwritten each morning.
This blueprint establishes an automated FinOps guardrail for Snowflake storage. Running weekly or on-demand, it queries SNOWFLAKE.ACCOUNT_USAGE.TABLE_STORAGE_METRICS, calculates the protective storage overhead ratio ((time_travel + failsafe) / active_data), and flags tables larger than your threshold that exceed configured limits. When runaway bloat is detected, it alerts your data platform team on Slack with dollar waste estimates and exact SQL remediation commands.
weekly_finops_audit trigger (io.kestra.plugin.core.trigger.Schedule) executes every Sunday at 06:00 UTC, or runs on-demand via the Kestra UI.audit_storage_overhead task (io.kestra.plugin.jdbc.snowflake.Query) queries snowflake.account_usage.table_storage_metrics, joining active, time travel, and fail-safe bytes to compute protection overhead ratios and dollar impacts.evaluate_storage_anomalies flowable task (io.kestra.plugin.core.flow.If) branches based on whether any tables breach max_overhead_ratio.notify_finops_slack (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) delivers an actionable Slack card detailing table names, active vs. protective gigabytes, and ALTER TABLE commands.log_compliant_storage records compliant status in the execution log.export_finops_manifest task records telemetry data for lineage logs and FinOps cost dashboards.Snowflake provides storage views in Account Usage, but built-in alerts only notify on hard credit quotas rather than storage overhead ratios. Kestra provides declarative, scheduled orchestration: it handles secure Snowflake JDBC connectivity, computes statistical overhead ratios, evaluates threshold breaches, and dispatches rich formatted notifications to your team.
| Name | Type | Default | Description |
|---|---|---|---|
min_table_size_gb |
INT | 50 |
Only flag tables whose total physical footprint exceeds this size in gigabytes. |
max_overhead_ratio |
FLOAT | 2.0 |
Flag tables where Time Travel and Fail-safe storage exceed active data by this multiple. |
storage_cost_per_tb_usd |
FLOAT | 23.00 |
Estimated monthly cost per terabyte of Snowflake storage. |
slack_channel |
STRING | #finops-alerts |
Slack channel destination for FinOps storage cost alerts. |
{{ outputs.audit_storage_overhead.rows }}: Array of table storage records containing database_name, schema_name, table_name, active_gb, time_travel_gb, failsafe_gb, protection_overhead_ratio, and estimated_monthly_waste_usd.{{ outputs.audit_storage_overhead.size }}: Total count of tables exceeding the protective storage ratio.{{ outputs.evaluate_storage_anomalies }}: Result of conditional branch evaluation.{{ outputs.export_finops_manifest.value }}: Structured JSON audit manifest recording execution timestamp and compliance status.SNOWFLAKE.ACCOUNT_USAGE schema views.IMPORTED PRIVILEGES on the SNOWFLAKE database.SNOWFLAKE_JDBC_URL: Snowflake JDBC connection string (e.g. jdbc:snowflake://<account_locator>.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.SNOWFLAKE_JDBC_URL, SNOWFLAKE_USER, SNOWFLAKE_PASSWORD, and SLACK_WEBHOOK_URL in your Kestra namespace secrets.SNOWFLAKE.ACCOUNT_USAGE such as TABLE_STORAGE_METRICS experience 45 to 120 minutes of data latency. Schedule the flow weekly or off-peak for reconciled metrics.TABLE_STORAGE_METRICS retains dropped tables during Time Travel and Fail-safe retention. The query filters WHERE deleted = FALSE to target currently active table assets.TRANSIENT immediately prevents future bloat.ALTER TABLE ... SET DATA_RETENTION_TIME_IN_DAYS = 1; for approved non-production schemas.io.kestra.plugin.notifications.mail.MailSend.