3 0
Read Time:2 Minute, 6 Second

During this first part of post we will discuss the External Functions in snowflake. An external function is a type of UDF. Unlike other UDFs, an external function does not contain its own code; instead, it calls code that is stored and executed outside Snowflake. External functions make it easier to access external API services such as geocoders, coindesk, crypto data and other custom code running outside of Snowflake.

For our use case, We will be hitting the Public API through REST service in AWS and once payload returned by API in JSON format , will pass the response to the snowflake and snowflake can  stores the JSON response for further analysis.

However, As per the above diagram, below is the complete flow:

To achieve the above Flow, below Technical steps needs to be followed.

The major steps in creating an external function on AWS are:

  1. Create the Remote Service (Lambda Function on AWS)
  2. Configure the Proxy Service (Amazon API Gateway)
  3.  Create the API Integration (in Snowflake)
  4. Create the External Function.
  5. Call the Function.


Create Remote Service (Lambda function):

a) Create Lambda Function

Lambda Function

b) Create the IAM Role and assign the required polies to the Role and attach it with Lambda function.

Lambda Role

Configure Proxy Service (Amazon API Gateway) several steps including:

  • Creating a new IAM role in your AWS account.
  • Creating an Amazon API Gateway endpoint and configuring it.
  • Securing your Amazon API Gateway endpoint.

a) Creating an IAM role for Snowflake use:

IAM Role

b) Creating an AWS API Gateway


API steps
API Image

c) Securing your Amazon API Gateway endpoint

Set Resource Policy
Resource Policy

In next part of the series, we will create API Integration and External Function inside the snowflake.

Average Rating

5 Star
4 Star
3 Star
2 Star
1 Star

Leave a Reply

Your email address will not be published. Required fields are marked *