Skip to content

Commit 1a3f3ea

Browse files
docs: CRUD support for snow resource monitors (#203)
1 parent 2acfe03 commit 1a3f3ea

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
---
2+
title: "Resource Monitors"
3+
description: Get started with Resource Monitors in LocalStack for Snowflake
4+
tags: ["Base"]
5+
---
6+
7+
## Introduction
8+
9+
Resource monitors in Snowflake allow administrators to track and control credit usage for warehouses and accounts. They help manage costs by defining limits and triggering actions (such as suspending warehouses) when thresholds are reached.
10+
11+
The Snowflake emulator offers CRUD support for resource monitors. These objects are placeholders only, they do not track usage or enforce limits. This allows you to test Terraform configurations or automation flows that reference resource monitors without enabling their actual functionality.
12+
13+
## Getting started
14+
15+
This guide is designed for users new to resource monitors and assumes basic knowledge of SQL and Snowflake. Start your Snowflake emulator and connect to it using an SQL client in order to execute the queries below.
16+
17+
In this guide, you will:
18+
19+
- Create a resource monitor.
20+
- View its properties.
21+
- Alter it to adjust quotas.
22+
- Drop it when it is no longer needed.
23+
24+
### Create a resource monitor
25+
26+
You can create a resource monitor with the `CREATE RESOURCE MONITOR` statement:
27+
28+
```sql
29+
CREATE RESOURCE MONITOR test_monitor
30+
WITH CREDIT_QUOTA = 100
31+
TRIGGERS ON 80 PERCENT DO SUSPEND;
32+
```
33+
34+
This example creates a monitor named `test_monitor` with a quota of 100 credits. When 80% of the quota is reached, it suspends associated warehouses.
35+
36+
### Show resource monitors
37+
38+
You can list all resource monitors in the emulator with:
39+
40+
```sql
41+
SHOW RESOURCE MONITORS;
42+
```
43+
44+
### Describe a resource monitor
45+
46+
You can view the properties of a specific monitor with:
47+
48+
```sql
49+
DESCRIBE RESOURCE MONITOR test_monitor;
50+
```
51+
52+
### Alter a resource monitor
53+
54+
You can change the quota or triggers of an existing resource monitor using `ALTER RESOURCE MONITOR`:
55+
56+
```sql
57+
ALTER RESOURCE MONITOR test_monitor
58+
SET CREDIT_QUOTA = 200;
59+
```
60+
61+
### Drop a resource monitor
62+
63+
When a monitor is no longer needed, you can drop it with:
64+
65+
```sql
66+
DROP RESOURCE MONITOR IF EXISTS test_monitor;
67+
```
68+

0 commit comments

Comments
 (0)