Snowflake
The Snowflake provider talks to Snowflake’s SQL REST API with key-pair authentication. AVACOM needs no Snowflake driver and no password.
-
Alerts in. Snowflake alerts (
CREATE ALERT) become AVACOM alerts. AVACOM reads their runs fromALERT_HISTORYevery 5 minutes.- An alert is firing when its latest run triggered it, and high when the alert itself failed.
- It is resolved when a later run finds its condition false. This also works when the run that triggered it is older than the history AVACOM reads, because AVACOM compares it with the state it holds.
-
Evidence out. For an incident’s users, hosts and services, AVACOM reads:
- Each user’s logins (
LOGIN_HISTORY_BY_USER), and the logins from the hosts’ client IPs. - Each user’s queries (
QUERY_HISTORY_BY_USER), and each service’s queries, taking the service as a warehouse (QUERY_HISTORY_BY_WAREHOUSE). Only queries that failed, were queued for an overloaded warehouse, or ran at least as long as Slow query become evidence.
They appear on the Root cause tab as snowflake.
- Each user’s logins (
These views are INFORMATION_SCHEMA table functions. They answer in real time for the last seven days, and show
only what the role may see. Each call returns at most 10,000 rows, the newest. When a user, warehouse or client
IP has more rows than that in the incident’s window, the Root cause tab says so and names the time before which
that part is not seen.
What the bank provides
Section titled “What the bank provides”| What | Details |
|---|---|
| Account | The account identifier: orgname-accountname, or the locator with its region (xy12345.eu-central-1) |
| User and key | A service user with an RSA public key set on it; AVACOM holds the private key |
| Role, warehouse, database | A role that may use a small warehouse and any one database (its INFORMATION_SCHEMA answers), and may see the history |
| Network | AVACOM reaches https://<account>.snowflakecomputing.com (or the PrivateLink host) on 443. If the account has a network policy, it allows AVACOM’s address |
Set the user up
Section titled “Set the user up”-- the key: openssl genrsa 2048 | openssl pkcs8 -topk8 -nocrypt -out rsa_key.p8-- openssl rsa -in rsa_key.p8 -pubout -out rsa_key.pubCREATE ROLE AVACOM_MONITOR;CREATE WAREHOUSE AVACOM_WH WAREHOUSE_SIZE = XSMALL AUTO_SUSPEND = 60 AUTO_RESUME = TRUE INITIALLY_SUSPENDED = TRUE;GRANT USAGE ON WAREHOUSE AVACOM_WH TO ROLE AVACOM_MONITOR;GRANT USAGE ON DATABASE OPS TO ROLE AVACOM_MONITOR;GRANT MONITOR ON ACCOUNT TO ROLE AVACOM_MONITOR; -- everyone's logins and queriesGRANT MONITOR EXECUTION ON ACCOUNT TO ROLE AVACOM_MONITOR; -- every alert's runsCREATE USER SVC_AVACOM TYPE = SERVICE DEFAULT_ROLE = AVACOM_MONITOR DEFAULT_WAREHOUSE = AVACOM_WH RSA_PUBLIC_KEY = 'MIIBIjANBgkqh...'; -- rsa_key.pub without its header linesGRANT ROLE AVACOM_MONITOR TO USER SVC_AVACOM;Without MONITOR, the history quietly shows only the service user’s own logins and queries. Your security team
may prefer narrower grants, such as MONITOR on the warehouses that matter.
What it costs
Section titled “What it costs”Every alert pull and every RCA runs statements on the warehouse, and resumes it when it is suspended. Snowflake
bills at least 60 seconds each time a warehouse resumes. With a pull every 5 minutes, an X-Small warehouse that
suspends after 60 seconds runs for about 12 minutes an hour. Use a warehouse of its own, X-Small, with
AUTO_SUSPEND = 60. To pull less often, set AVACOM_SNOWFLAKE_PULL_MINUTES (for example 15) on AVACOM’s API
and its workers. It applies to every Snowflake provider of the installation.
Connect
Section titled “Connect”-
In AVACOM, open Providers, choose Snowflake and fill in:
Field Value Snowflake user, account identifier As above Snowflake private key (PEM) The contents of rsa_key.p8; a passphrase only if the key is encryptedWarehouse, role, database AVACOM_WH,AVACOM_MONITOR,OPS; empty means the user’s defaults, but alerts and evidence need a databaseHost Only for PrivateLink: a *.snowflakecomputing.comhost, over https. Any other host must be listed inAVACOM_OUTBOUND_ALLOWED_HOSTSAlert history to read, slow query, statement timeout 24 hours, 60 seconds, 60 seconds by default -
Turn on Pulling Enabled for its alerts.
-
Press Connect. AVACOM signs in and checks each permission with statements of its own:
- Connect: the session has the role, warehouse and database you named.
- Alert history: the role may read
ALERT_HISTORY, and holdsMONITOR EXECUTIONon the account itself. - Login history, Query history: the role may read each one, and either holds
MONITORon the account itself or sees another user’s rows from the last six days.
A check that passes only for the user’s own rows reads Limited, with the grant that is missing. A grant that comes through another role cannot be seen this way. If the evidence shows other users’ rows, the role has what it needs.
In workflows
Section titled “In workflows”A workflow step can run SQL on Snowflake. Values go in as bound parameters, never into the SQL text:
- name: open-orders provider: type: snowflake config: "{{ providers.snowflake }}" with: query: "SELECT STATUS, COUNT(*) AS N FROM PAYMENTS.CORE.ORDERS WHERE HOST = ? GROUP BY STATUS" parameters: ["{{ alert.host }}"]- Rows come back as lists of values in column order, as before:
{{ steps.open-orders.results.0.1 }}is the first row’sN. Addas_dict: trueto get them by column name (results.0.N). Columns must then have different names (alias them withAS). - Values. Numbers with decimals come back as exact decimals, timestamps in UTC.
- Size and time. A step returns at most 10,000 rows. Set
max_rows(up to 100,000) for more or fewer. The whole statement, including fetching a large result, must finish within the provider’s statement timeout. - Older steps that wrote
{table}placeholders filled byquery.formatare refused: write?and passparameters. A string in place of theparameterslist is refused too.