Set up Openflow - Snowflake Deployment: Create the execute-as role and external access integrations¶
Openflow - Snowflake Deployment runtimes need a few supporting resources before they can access your data:
- An execute-as role that flows use to access Snowflake objects
- Network rules and external access integrations (EAI) that let the runtime reach external data sources
This topic describes the creation of these resources.
- Create an execute-as role and grant it the privileges needed to write data to Snowflake.
- Associate the execute-as role with the runtime.
- Create external access integrations and associate them with the runtime. See Creating network rules and external access integrations.
- Configure outbound PrivateLink if required to connect to a private system using SPCS egress.
Create the execute-as role¶
When creating an Openflow runtime, you associate a role with it. Flows that run within the runtime execute as this role, so it’s called the execute-as role. You can reuse the same execute-as role across multiple runtimes. For more information, see What is an execute-as role?.
Creating the role is a prerequisite for creating a runtime:
-
Create the role.
Note
<RUNTIME_NAME>denotes the name of the associated runtime. -
Allow the execute-as role to use an existing warehouse that you plan to use for data ingestion. Use this warehouse later when configuring your connectors for runtimes where you use this execute-as role.
-
Allow the execute-as role to use, create, or otherwise access Snowflake objects.
Note
Depending on the Openflow connector being created, the required underlying objects vary. The example below is for illustration purposes only.
Creating network rules and external access integrations¶
The following steps apply to both gen 1 and gen 2 Snowflake deployments. Both generations require network rules and EAIs so the runtime can reach external data sources.
Snowflake’s security model provides secure access to specific endpoints and systems external to Snowflake using network policies.
Two key aspects of network policies are Network rules and External Access Integrations (EAI). Each of which is used to provide secure access to external resources required by the runtime.
There are three steps that are required to create network rules and external access integrations:
- Create the network rule, grouping the network identifiers into logical areas.
- Create the external access integration (EAI), specifying the list of network rules and ensuring the execute-as role has USAGE on the EAI.
- Associate the EAI with the Runtime in the Openflow UI when creating Runtimes.
To create the required network rule and EAI, perform the following steps:
Note
These examples use RUNTIME_NAME as a placeholder for the name of the Runtime being created.
Do not use CREATE OR REPLACE on network rules or EAIs
Replacing a network rule or external access integration silently detaches it from every runtime
that references it. Use CREATE ... IF NOT EXISTS for new objects, and ALTER to modify existing
ones.
-
Create an appropriate network rule. See CREATE NETWORK RULE for more information.
Note
Snowflake recommends creating network rules in the same infrastructure schema (
openflow_db.openflow_schema) you’ve been using for Openflow objects, so that everything is in one place. An EAI is an account-level object, so it has no database or schema; a network rule is a schema-level object. Where you keep the network rule is your choice as long as the execute-as role has access to the EAI, but using the infrastructure schema keeps things simple and consistent. -
Create an external access integration, or add the network rule to an existing one. See CREATE EXTERNAL ACCESS INTEGRATION for more information.
To create a new EAI:
To add the network rule to an existing EAI, first check which rules are already associated with it, then update the EAI to include both the existing and new rules:
In the output, find the
ALLOWED_NETWORK_RULESproperty and note the existing rules. Then update the EAI, listing all existing rules along with the new one: -
Grant access to the EAI to the previously created execute-as role.
Do not use CREATE OR REPLACE on network rules or EAIs
Replacing a network rule or external access integration silently detaches it from every runtime
that references it. Use CREATE ... IF NOT EXISTS for new objects, and ALTER to modify existing
ones.