Prerequisites
ACCOUNTADMIN, or an equivalent role, to create a role, a service user, a network policy, and a token.- A warehouse the role can use. The connection test needs no compute, so it can pass while real analysis fails without one. Setup step 1 creates a capped one.
- If your account has an authentication policy, its
AUTHENTICATION_METHODSmust includePROGRAMMATIC_ACCESS_TOKEN, or the token is refused at sign-in. - The Admin role in the CloudThinker workspace, which you need to add connections. See Roles.
Setup
Run all the SQL below asACCOUNTADMIN (start with USE ROLE ACCOUNTADMIN;), since creating a resource monitor needs it. The SQL uses CT_WH as the warehouse. To use a warehouse you already have, swap in its name everywhere.
Create a capped warehouse (recommended)
CREDIT_QUOTA: an X-Small warehouse uses 1 credit per running hour, billed per second with a 60-second minimum each time it resumes. A quota of 10 covers 10 hours of running time a month. When the quota is used up, the warehouse suspends and analysis queries fail until the next month or until an admin raises it.Create a read-only role
Create a service user
SERVICE user has no password, MFA, or SSO, so the token is its only way in:Attach a network policy
ALLOWED_IP_LIST:('0.0.0.0/0') lets you try the connection before you have the list. Never leave it on a production account.Create a programmatic access token
token_secret column of the result. Snowflake shows it only once, and it stops working on the expiry day. DAYS_TO_EXPIRY goes up to 365 unless your account sets a lower limit. CloudThinker doesn’t warn before the token expires, so set a calendar reminder a week before then to rotate it. To check expiry dates later, run SHOW USER PROGRAMMATIC ACCESS TOKENS FOR USER SVC_CLOUDTHINKER; and read the expires_at column.Add the connection in CloudThinker
Connected to MYORG-MYACCOUNT (AWS_US_WEST_2), role CT_READONLY, warehouse CT_WH.Connection details
MYORG_MYACCOUNT) also works.
Required permissions
Agent capabilities
Verify the connection
ACCOUNT_USAGE view as readable or blocked, with the GRANT that fixes a blocked one.
Example prompts
Write access
Allow writes is off on new Snowflake connections. Every change an agent makes goes through your workspace’s Approvals first. On the default Auto · Rules + AI · Ask me mode, AI judgment can let a safe change run without asking — and an Allow Rule can too, once CloudThinker turns on Rule enforcement for your workspace. Choose Manual to approve every change yourself. With the switch on, AI can approve a warehouse suspend with no person involved. For a production account, choose Manual before you turn writes on, so a person approves every change — that is the control that works today. Once CloudThinker turns on Rule enforcement for your workspace, an Ask first Rule can narrow the wait to the Snowflake connection alone: in a chat, type/create-policy Ask first for every write on the Snowflake connection, then accept it under Approvals → Rules → Needs review. The Cassandra guide walks through checking the proposal.
Write means exactly two actions, not arbitrary SQL:
- Suspend or resume one named warehouse.
- Keep measured findings in a
CT_FINDINGStable, when you ask CloudThinker to. On the first save, it creates the table in the one schema where the role hasCREATE TABLE. If the role can write to several schemas, it asks you which one. You can also name it in your prompt, for exampleMONITORING.ALERTS.
CT_FINDINGS has six columns: RECORDED_AT_UTC, CATEGORY, SEVERITY, SUBJECT, DETAIL, and SOURCE. Saving a finding and pruning old ones are both writes, so each goes through approvals. Nothing is pruned automatically: rows stay until you ask CloudThinker to remove those older than a number of days, or delete them yourself.
Resizing a warehouse, changing a resource monitor, or lowering DATA_RETENTION_TIME_IN_DAYS is still handed to you as a statement to run in Snowsight.
Allow writes only lets CloudThinker ask. The role still needs the grants, and with a read-only token Snowflake denies every write. To turn writes on:
Create a write role and token
DEV_WH with the warehouses the agent may suspend, and MONITORING.ALERTS with the schema for CT_FINDINGS. Grant OPERATE only on warehouses the agent may suspend, never a shared production warehouse:token_secret column.Update the connection
CT_READWRITE, and click Save and test.Turn on Allow writes
Remove the read-only token
ALTER USER SVC_CLOUDTHINKER REMOVE PROGRAMMATIC ACCESS TOKEN CT_TOKEN;.Turn off Allow writes
Swap back to a read-only token
CT_READONLY, and click Save and test.Remove the write token and role
Rotate the token
Create the new token
token_secret column.Replace it in CloudThinker
Remove the old token
ALTER USER SVC_CLOUDTHINKER REMOVE PROGRAMMATIC ACCESS TOKEN <old_token_name>;, for example CT_TOKEN or CT_TOKEN_RW.Troubleshooting
Authentication fails at once (390403)
Authentication fails at once (390403)
ALTER USER SVC_CLOUDTHINKER SET NETWORK_POLICY = CT_POLICY;.It worked yesterday and fails today (390318)
It worked yesterday and fails today (390318)
Connected, but every query fails (090073)
Connected, but every query fails (090073)
GRANT fixes this. An account admin raises or resets the resource monitor. The status stays Connected because the token is valid and the test needs no compute.No active warehouse selected (000606)
No active warehouse selected (000606)
DEFAULT_WAREHOUSE and the connection has none. Set Warehouse, or give the user a default.A section comes back empty
A section comes back empty
ACCOUNT_USAGE lags by up to a few hours and keeps 365 days of history, so a short window on a quiet account can return no rows.Security
- Least privilege — grant only the permissions the agents need for your use case; start read-only and widen later.
- Read-only by default — use read-only credentials unless you want agents to make changes through this connection.
- Rotate credentials — rotate keys and tokens on your normal schedule; CloudThinker picks up the new value when you update the connection.
- Revoke on offboarding — remove the credential at the provider when you delete a connection or a teammate leaves.
- Dedicated service user: a
TYPE = SERVICEuser has no password, MFA, or SSO, so the token is the only way in and its activity is easy to audit. - Restrict and expire the token:
ROLE_RESTRICTIONcaps what the connection can reach, andDAYS_TO_EXPIRYforces rotation.