Data Loading, Unloading, and Connectivity · Topic 7 of 7
Storage, API and Git Integrations
Set up storage integrations for external stages, API integrations for external functions and Git, and Git repository clones in Snowflake for SnowPro Core.
- 5 min
- Integrations are account level objects;
CREATE INTEGRATIONbelongs to ACCOUNTADMIN by default. - Storage integration: provider identity plus
STORAGE_ALLOWED_LOCATIONS, used by external stages; AWS needs the trust policy fromDESC INTEGRATION. - API integration:
API_PROVIDERplusAPI_ALLOWED_PREFIXES, used for external functions and Git repositories.
What it is
An integration is an account level object that holds the trust relationship between Snowflake and an outside service. Admins create it once, and other users reference it by name, so no keys or passwords appear in stage or function definitions.
This page covers three kinds. A storage integration lets external stages reach cloud storage. An API integration lets Snowflake call an external HTTPS endpoint, such as an API gateway or a Git server. Git integration uses an API integration to clone a remote Git repository into Snowflake.
How it works
Who can create integrations
Creating any integration needs the account level CREATE INTEGRATION privilege, which only ACCOUNTADMIN has by default; it can be granted to other roles. Other roles then need USAGE on the integration to reference it.
Storage integrations
A storage integration stores an identity in your cloud provider (for AWS, an IAM role) and a list of allowed locations. Stages then use it instead of credentials.
CREATE STORAGE INTEGRATION s3_int
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'S3'
ENABLED = TRUE
STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::123456789012:role/snowflake_load'
STORAGE_ALLOWED_LOCATIONS = ('s3://sales-bucket/landing/', 's3://logs-bucket/')
STORAGE_BLOCKED_LOCATIONS = ('s3://sales-bucket/landing/private/');
| Parameter | Purpose |
|---|---|
TYPE = EXTERNAL_STAGE | The integration is used by external stages |
STORAGE_PROVIDER | 'S3' (also 'S3GOV', 'S3CHINA'), 'GCS' or 'AZURE' |
STORAGE_AWS_ROLE_ARN | The IAM role Snowflake assumes on AWS |
AZURE_TENANT_ID | The Azure tenant that owns the storage accounts |
STORAGE_ALLOWED_LOCATIONS | Required. Buckets or paths that stages may use |
STORAGE_BLOCKED_LOCATIONS | Optional. Paths stages may not use, even inside allowed ones |
The AWS setup is a handshake between the two sides.
- Create an IAM policy and role in AWS that can read (and, for unloads, write) the bucket.
- Create the storage integration with the role ARN.
- Run
DESC INTEGRATION s3_intto readSTORAGE_AWS_IAM_USER_ARNandSTORAGE_AWS_EXTERNAL_ID. - Put those values in the role's trust policy, so only this Snowflake identity can assume the role.
- Create stages with
STORAGE_INTEGRATION = s3_int.
On Google Cloud, Snowflake creates a service account that you grant access to the bucket. On Azure, you open a consent URL and grant the Snowflake application access to the storage account.
One storage integration can serve many external stages, as long as each stage URL falls inside an allowed location.
When a question asks how to "avoid storing cloud credentials in Snowflake" or "let engineers create stages only for approved buckets", the answer is a storage integration with STORAGE_ALLOWED_LOCATIONS.
API integrations
An API integration stores the details Snowflake needs to call an HTTPS endpoint, and an allow list of URL prefixes.
| Parameter | Purpose |
|---|---|
API_PROVIDER | The kind of endpoint, such as aws_api_gateway, azure_api_management, google_api_gateway or git_https_api |
API_AWS_ROLE_ARN | For AWS API Gateway, the IAM role Snowflake assumes |
API_ALLOWED_PREFIXES | Required. URL prefixes the integration may call |
API_BLOCKED_PREFIXES | Optional. Prefixes blocked even inside allowed ones |
ENABLED | Required. TRUE turns it on; FALSE stops dependent objects from working |
Main uses:
- External functions: SQL functions that send rows to a remote service through a cloud API gateway (Amazon API Gateway, Azure API Management or Google Cloud API Gateway) and return the results.
- Git repositories: with
API_PROVIDER = git_https_api, the integration lets Snowflake reach a Git server.
An API integration is different from an external access integration, which lets code in UDFs and stored procedures reach external network locations defined by network rules.
Git integration
Git integration brings a remote repository into Snowflake as a Git repository clone, which holds its branches, tags and commits. Supported providers include GitHub, GitLab, Bitbucket, Azure DevOps and AWS CodeCommit.
CREATE SECRET git_secret
TYPE = password
USERNAME = 'build-bot'
PASSWORD = '<personal access token>';
CREATE API INTEGRATION git_api_int
API_PROVIDER = git_https_api
API_ALLOWED_PREFIXES = ('https://github.com/my-org/')
ALLOWED_AUTHENTICATION_SECRETS = (git_secret)
ENABLED = TRUE;
CREATE GIT REPOSITORY etl_repo
API_INTEGRATION = git_api_int
GIT_CREDENTIALS = git_secret
ORIGIN = 'https://github.com/my-org/etl.git';
- A public repository needs no secret; a private one needs a secret with a username and personal access token, or OAuth.
ALTER GIT REPOSITORY etl_repo FETCHpulls the latest commits from the remote.- Files are referenced by path, for example
@etl_repo/branches/main/sql/setup.sql. - You can run a SQL file with
EXECUTE IMMEDIATE FROM, use Python files as handlers for UDFs and stored procedures, and work with the repository in Snowsight Workspaces and notebooks.
A Git repository clone does not update itself. Run ALTER GIT REPOSITORY ... FETCH (or fetch in Snowsight) to see new commits before running files from it.
Common mistakes
Putting keys in every stage. Stages with embedded keys spread secrets and bypass admin control. Use one storage integration and grant USAGE on it.
Skipping the trust policy step. The AWS role must trust the IAM user ARN and external ID shown by DESC INTEGRATION, or stage access fails.
Using a storage integration for an API. Storage integrations serve external stages. Endpoints such as API gateways and Git servers use an API integration.
Expecting automatic sync from Git. The clone changes only when you fetch.
What to remember for the exam
- Integrations are account level objects;
CREATE INTEGRATIONbelongs to ACCOUNTADMIN by default. - Storage integration: provider identity plus
STORAGE_ALLOWED_LOCATIONS, used by external stages; AWS needs the trust policy fromDESC INTEGRATION. - API integration:
API_PROVIDERplusAPI_ALLOWED_PREFIXES, used for external functions and Git repositories. - Git integration: secret, API integration with
git_https_api, thenCREATE GIT REPOSITORY; refresh withFETCH.
Check yourself
What does a storage integration replace in an external stage definition?
The cloud credentials. The stage references the integration, which holds the provider identity and allowed locations.
Which API_PROVIDER value connects Snowflake to a remote Git repository?
git_https_api, used in an API integration that CREATE GIT REPOSITORY references.
How do you get new commits from the remote into a Git repository clone?
Run ALTER GIT REPOSITORY with FETCH, or fetch from Snowsight.
Topic 7 of 7 in Data Loading, Unloading, and Connectivity
Test yourself on Data Loading, Unloading, and Connectivity
The full Snowflake SnowPro Core COF-C03 question bank has 845 questions, with timed practice exams and an explanation for every answer.
This study guide is independent and is not affiliated with, endorsed by, or sponsored by Snowflake. Vendor names, certification names and exam codes are trademarks of their respective owners and are used for identification only.