Monitor credit usage with budgets¶

A budget defines a monthly spending limit on the compute costs for a Snowflake account or a custom group of Snowflake objects. When the spending limit is projected to be exceeded, a notification is sent. You can configure the budget to send this notification to a list of email addresses, a queue provided by a cloud service (Amazon SNS, Azure Event Grid, or Google Cloud PubSub), or a webhook for a third-party system (for example, Slack, Microsoft Teams, or PagerDuty).

Account budget and custom budgets¶

The account budget monitors spending for all credit usage in the account.

You can also create a custom budget to monitor the spending limits for a specific group of supported objects.

For both types of budgets, you must set up the spending limit and specify how you want to receive notifications.

To start using budgets in Snowflake, activate the account budget.

Spending limit and time interval¶

The spending limit is expressed in Snowflake credits and is used for alerting and notifications purposes only. The spending limit is set for the time interval of one calendar month.

The time interval starts at 12:00AM UTC on the first day of the month and ends at 11:59PM UTC on the last day of the month. If a budget is created after the first day of the month, the first monitoring interval is the period until the last day of the current month, then is reset on the first of the following month.

If you activate your account budget after the first day of the month, data starting from the beginning of the month is backfilled and used to determine if you are going to exceed your spending limit for the month.

If you create a custom budget after the first day of the month, historical data for the month is only backfilled for resources that were added to the budget using a tag. Data from resources added individually are not backfilled.

Note

If you create a custom budget and individually add resources to the budget instead of using a tag, consider the following:

  • Forecasting for future spend by those resources is based on the credit usage only for the days after the budget is enabled.

  • You might exceed your budget for the first month. Because the data for the resources is not backfilled, the forecasting might be incorrect. Subsequent months will correctly forecast credit usage based on spending history.

Supported services¶

Budgets monitor credit usage for the following services. Use the table to determine whether custom budgets support the service and which object is associated with the service.

Note

Account budget support for serverless features depends on the availability of service types in the Account Usage METERING_HISTORY view view.

Service

Account budget

Custom budget

Object

AI_SERVICES

✔

AUTO_CLUSTERING

✔

✔

Table

COPY_FILES

✔

✔

Database

DATA_QUALITY_MONITORING

✔

✔

Table

HYBRID_TABLE_REQUESTS

✔

MATERIALIZED_VIEW

✔

✔

Materialized view

PIPE

✔

✔

Pipe

QUERY_ACCELERATION

✔

✔

Warehouse

REPLICATION

✔

✔

Database, Replication group

SEARCH_OPTIMIZATION

✔

✔

Table

SERVERLESS_ALERTS

✔

✔

Alert

SERVERLESS_TASK

✔

✔

Task

SNOWPARK_CONTAINER_SERVICES

✔

✔

Compute pool

SNOWPIPE_STREAMING

✔

✔

Table

WAREHOUSE_METERING

✔

✔

Warehouse

Budgets notifications¶

A budget sends a daily alert notification when current spending is on track to exceed the spending limit based on time-series forecasting. Notifications begin when the projected spending is more than 10% above the spending limit.

To receive automatic alert notifications, you must do the following as part of activating the account budget or creating a custom budget:

  • Set a spending limit for the budget.

  • Specify how you want to receive notifications about the budget.

For more information, see Notifications for budgets.

Budgets roles and privileges¶

To enable a custom role in your account to work with budgets, you can grant the following roles and privileges.

Note

Snowflake provides application roles and database roles that control access to all cost-related features, including budgets. For information about granting these roles to a custom role rather than working with budget-specific roles and privileges, see Access control for cost management.

Application roles to manage the account budget¶

You can grant the following application roles to a custom role in your account to monitor or manage the account budget:

Application Role

Description

BUDGET_VIEWER

Enables a role to view budget usage data and list the resources in the budget.

BUDGET_ADMIN

Enables a role to activate or deactivate the account budget and modify the properties of a budget including spending limit, the notification integrations to use, the list of email addresses to receive notifications, and the mute notifications setting.

In addition to the application role, there are other required privileges that must be granted to enable a custom role to monitor or manage the account budget. For more information, see Required roles and privileges.

Instance roles to manage custom budgets¶

Each custom budget has instance roles that you can grant to other roles to view or modify the budget:

Instance Role

Description

VIEWER

Enables a role to view budget usage data.

ADMIN

Enables a role to modify the properties of a budget including spending limit, the notification integrations to use, the list of email addresses to receive notifications, the mute notifications setting, and the objects in the group.

In addition to the instance role, there are other required privileges that must be granted to enable a custom role to create, monitor, or modify a custom budget. For more information, see Required roles and privileges.

Required roles and privileges¶

In addition to the application or instance roles, the following privileges must be granted to a custom role to monitor or manage budgets:

Privilege or role

Budget type

Create

Manage

Monitor

Notes

USAGE_VIEWER

Both

✔

✔

✔

Grant the Snowflake database role USAGE_VIEWER to the custom role.

USAGE

Custom

✔

✔

✔

Grant the USAGE privilege on the database that contains the custom budget.

USAGE

Custom

✔

✔

✔

Grant the USAGE privilege on the schema that contains the custom budget.

SNOWFLAKE.BUDGET_CREATOR

Custom

✔

Grant this database role to the custom role to enable it to create custom budgets.

CREATE SNOWFLAKE.CORE.BUDGET

Custom

✔

Grant this privilege on the schema that will contain the custom budget.

APPLYBUDGET

Custom

✔

Must be granted on each object to be added or removed from a custom budget.

USAGE

Custom

✔

To add or remove schema objects from a custom budget, this privilege must be granted on the database and schema that contains the object.

For more information and examples, see the following sections:

Limitations¶

The following are limitations for Budgets:

  • Instances of the BUDGET class can’t be replicated to target accounts.

  • An account can contain a maximum of 100 custom budgets.

  • Currently, Budgets does not support monitoring costs for Hybrid tables.

  • The following account-level parameters must be unset or set to the default value:

    • AUTOCOMMIT must be unset or set to TRUE.

      If this parameter is set to FALSE, activating a budget might fail, or usage might not be tracked correctly.

    • TIMESTAMP_INPUT_FORMAT must be unset or set to AUTO.

      If this parameter isn’t set to AUTO, usage might not be tracked correctly.

    Before you activate budgets, check the values of these parameters by executing the SHOW PARAMETERS command:

    SHOW PARAMETERS LIKE 'AUTOCOMMIT' IN ACCOUNT;
    
    Copy
    SHOW PARAMETERS LIKE 'TIMESTAMP_INPUT_FORMAT' IN ACCOUNT;
    
    Copy

    Note

    You must set these parameters at the account level. Setting the parameters at a lower level (for example, at the session level) doesn’t have an effect on activating budgets or tracking usage.