Exercise 2.1 โ€” Free-Tier Setup + First Warehouse + Cost Guardrails

30 minutes end-to-end. At the end you'll have a working Snowflake trial account, a properly sized warehouse, a database, a role, and enough cost protection that you could leave the tab open for a month without damage. Required before any other Snowflake lesson.

Cost: $0. Snowflake gives you $400 in credits, 30 days, no credit card. You will burn about $0.05โ€“$0.20 doing this exercise. Your whole Snowflake module will consume <$10 of credits if you follow the guardrails.

Step 1 โ€” Sign up

Step 2 โ€” Tour Snowsight for 5 minutes

Left nav:

Step 3 โ€” Run your first SQL

Open a new worksheet. Make sure the role selector (top right of the worksheet) is ACCOUNTADMIN โ€” it will be by default.

Paste this and run (Cmd/Ctrl+Enter, or click the play button):

SELECT CURRENT_ACCOUNT(), CURRENT_REGION(), CURRENT_USER(), CURRENT_ROLE();

You should see one row back. Congratulations โ€” you are now billing compute. (Very little, but technically.)

Step 4 โ€” Create a learning warehouse with guardrails

Replace the worksheet contents with this and run it:

-- Cost-protected learning warehouse.
-- Runs only when queries come in. Stops within 60s of idle.

CREATE WAREHOUSE IF NOT EXISTS LEARN_WH
  WITH
    WAREHOUSE_SIZE      = 'XSMALL'
    AUTO_SUSPEND        = 60
    AUTO_RESUME         = TRUE
    INITIALLY_SUSPENDED = TRUE
    MIN_CLUSTER_COUNT   = 1
    MAX_CLUSTER_COUNT   = 1
    SCALING_POLICY      = 'STANDARD'
    COMMENT             = 'learning, $400 trial, auto-suspend 60s';

USE WAREHOUSE LEARN_WH;

Verify in Admin โ†’ Warehouses that it exists and is Suspended. That's correct โ€” it starts when you query.

Don't use COMPUTE_WH for lessons. It's the default with AUTO_SUSPEND of 10 minutes. That's 10ร— what you want for learning. Always route learning queries to LEARN_WH.

Step 5 โ€” Create a learning database + schema

CREATE DATABASE IF NOT EXISTS LEARN_DB;
CREATE SCHEMA IF NOT EXISTS LEARN_DB.UTILITY;
USE DATABASE LEARN_DB;
USE SCHEMA UTILITY;

Step 6 โ€” Create some utility-domain sample data

We'll use this across the module. It's a toy meter-reads table loaded with synthetic data generated by Snowflake itself โ€” no external file needed.

CREATE OR REPLACE TABLE meter_reads (
  meter_id       STRING,
  premise_zip    STRING,
  read_ts        TIMESTAMP_NTZ,
  consumption_kwh NUMBER(10,3),
  quality_flag   STRING
);

-- Generate 1M synthetic meter reads across 1000 meters, last 30 days.
INSERT INTO meter_reads
SELECT
  'MTR-' || LPAD(UNIFORM(1, 1000, RANDOM()), 5, '0')                    AS meter_id,
  TO_CHAR(97000 + UNIFORM(1, 299, RANDOM()))                          AS premise_zip,
  DATEADD(minute, -UNIFORM(0, 60*24*30, RANDOM()), CURRENT_TIMESTAMP())  AS read_ts,
  ROUND(UNIFORM(0, 5000, RANDOM()) / 1000.0, 3)                     AS consumption_kwh,
  CASE WHEN UNIFORM(1, 100, RANDOM()) < 5 THEN 'E' ELSE 'G' END         AS quality_flag
FROM TABLE(GENERATOR(rowcount => 1000000));

Run SELECT COUNT(*) FROM meter_reads; โ€” should say 1,000,000.

Step 7 โ€” Set your cost guardrails

Go to Admin โ†’ Cost Management โ†’ Resource Monitors โ†’ + Resource Monitor. Create one called LEARNING_GUARD:

This is your seat belt. If you ever run an accidental catastrophic query, Snowflake will shut the warehouse down before you lose the $400 trial.

Step 8 โ€” Verify everything

Run this audit query โ€” it should return sensible results:

SELECT
  CURRENT_WAREHOUSE()  AS current_wh,
  CURRENT_DATABASE()   AS current_db,
  CURRENT_SCHEMA()     AS current_schema,
  (SELECT COUNT(*) FROM meter_reads)          AS reads_loaded,
  (SELECT COUNT(DISTINCT meter_id) FROM meter_reads) AS unique_meters;

Expected: LEARN_WH, LEARN_DB, UTILITY, 1000000, ~1000.

Step 9 โ€” Save what matters to your notepad

Pop open the ๐Ÿ““ notepad (bottom-right FAB) and save these. Future you will thank you.

Checkpoint