In this lesson we will:
- Learn about Snowflakes resource monitor feature, which is the main tool for limiting and controlling Snowflake spend.
As discussed, Snowflake is billed on a consumption based pricing model, where you pay exactly for the storage and compute power that you use.
This is great for keeping costs down, but it does mean that businesses are at risk of large bills as more people use the platform.
For this reason, Snowflake gives us a feature called Resource Monitors, which allow us to limit and monitor the spend of our Snowflake accounts and individual warehouses within them.
By adding a budget, businesses will be protected from human error such as creating and then leaving a very large cluster operating.
We could, for instance, limit the account to a $500 spend per week, or split this up across different virtual data warehouses such that our finance function and sales function each have a weekly budget.
Defining A Resource monitor
A resource monitor has 4 parts that we need to set:
- The number of credits budgeted to the resource monitor - e.g. 100 credits
- The time period that we care about - e.g. Daily, Weekly or Monthly and from when the period strategies
- The triggering actions to take - e.g. send a notification or suspend the warehouse immediateley
- Who to notify in the case of notifications
Once created, resource monitors can then be assigned to either the entire account, or individual or groups of data warehouses as per your organisational model.
Creating A Resource Monitor
It is possible to create resource monitors through the Snowflake classic user interface or via SQL.
create OR REPLACE resource monitor credit_resource_monitor with credit_quota = 1, frequency = monthly, start_timestamp = immediately, notify_users = ( BENJAMINWOOTTON ) triggers on 50 percent do notify
We can view details about the created resource monitor using the following SQL:
SHOW RESOURCE MONITORS;
When a resource monitor is triggered, we can expect to see the results in two places.
Firstly, the classic UI has a Notifications icon in the top right, which will be populated.
Secondly, email notifications can also be triggered if the user profile is setup to accept them.