Network Policies
π What are Network Policies in Snowflake?β
Network Policies in Snowflake allow administrators to control and restrict client connections to Snowflake based on IP addresses or CIDR ranges. This enhances security by ensuring only trusted networks can access your Snowflake account.
π― Why Use Network Policies?β
- βοΈ Limit access to known and trusted networks (like your office, VPN, cloud environment).
- βοΈ Prevent unauthorized connections from unknown IP addresses.
- βοΈ Meet security and compliance requirements (like PCI-DSS, SOC 2).
- βοΈ Reduce risk of credential theft by limiting where logins can occur from.
βοΈ How to Create and Use Network Policiesβ
1οΈβ£ Create a Network Policyβ
Use the CREATE NETWORK POLICY command:
CREATE NETWORK POLICY my_policy
ALLOWED_IP_LIST = ('203.0.113.0/24', '198.51.100.10')
BLOCKED_IP_LIST = ('192.0.2.0/24');
-
β
ALLOWED_IP_LIST: IPs or CIDRs that are permitted. -
β
BLOCKED_IP_LIST: IPs or CIDRs that are explicitly denied, even if theyβre in the allowed list.
2οΈβ£ Assign the Policyβ
Assign to the entire account:
ALTER ACCOUNT SET NETWORK_POLICY = my_policy;
Or to a specific user (overrides the account-level policy):
ALTER USER jdoe SET NETWORK_POLICY = my_policy;
3οΈβ£ Manage and View Policiesβ
- β List all policies:
SHOW NETWORK POLICIES;
- β Describe a specific policy:
DESCRIBE NETWORK POLICY my_policy;
- β Remove a policy (unassign from the account/user):
ALTER ACCOUNT UNSET NETWORK_POLICY;
ALTER USER jdoe UNSET NETWORK_POLICY;
- β Drop a policy (permanently delete):
DROP NETWORK POLICY my_policy;
β οΈ Limitations and Considerationsβ
β Policies only control login access β they donβt apply to Snowflake data transfers (like loading data via Snowpipe).
β Snowflakeβs public endpoints are still accessible to those within allowed IPs β consider private connectivity (like PrivateLink) for stronger isolation.
π Roles and Privileges for Network Policiesβ
| Role/Privilege | Purpose |
|---|---|
ACCOUNTADMIN | Full control to create, assign, drop policies. |
SECURITYADMIN | Can manage policies at the user level. |
π Best Practices for Network Policiesβ
- β Start with known trusted IPs (like corporate VPN, office subnets).
- β Use CIDR ranges for easier management of cloud-based infrastructure.
- β Combine network policies + MFA for robust defense.
- β
Review
LOGIN_HISTORYfor failed login attempts from blocked networks. - β Regularly update allowed lists as your network evolves.
β‘ Key Takeawaysβ
- βοΈ Network Policies restrict who can connect to Snowflake based on IP.
- βοΈ Use
CREATE NETWORK POLICYto define them and assign them to users or the entire account. - βοΈ Helps with security, compliance, and risk reduction.
- βοΈ Pair with MFA and private connectivity (like AWS PrivateLink) for stronger security posture.