Create Storage Integration
Create a Snowflake storage integration that provides secure, credential-free access to external cloud storage for data loading and unloading.
When to Use
Use this skill when the user wants to:
- Connect Snowflake to an S3 bucket, GCS bucket, Azure container, or OneLake lakehouse
- Set up credential-free access for external stages
- Create a new storage integration for data loading/unloading pipelines
Key Concepts
- Storage integration: A Snowflake object that stores a generated IAM entity for external cloud storage. Stages that reference an integration don't need inline credentials.
- One integration, many stages: A single integration can back multiple external stages, as long as each stage URL falls within
STORAGE_ALLOWED_LOCATIONS. - IAM trust is a two-step process: (1) Create the integration in Snowflake to generate an IAM entity, then (2) grant that entity permissions in your cloud provider.
CREATE OR REPLACEbreaks stages: It generates a new hidden ID, breaking all stages that reference the old integration. Prefer creating new integrations or use ALTER for changes.
Workflow
Step 1: Determine the Cloud Provider
| Provider | STORAGE_PROVIDER |
URL prefix | Required params |
|---|---|---|---|
| Amazon S3 | 'S3' |
s3:// |
STORAGE_AWS_ROLE_ARN |
| AWS China | 'S3CHINA' |
s3china:// |
STORAGE_AWS_ROLE_ARN |
| AWS GovCloud | 'S3GOV' |
s3gov:// |
STORAGE_AWS_ROLE_ARN |
| Google Cloud Storage | 'GCS' |
gcs:// |
(none) |
| Microsoft Azure | 'AZURE' |
azure://<account>.blob.core.windows.net/ |
AZURE_TENANT_ID |
| Microsoft Fabric OneLake | 'AZURE' |
azure://onelake.blob.fabric.microsoft.com/ |
AZURE_TENANT_ID |
Step 2: Gather Required Information
All providers:
- Integration name
- Bucket/container URLs to allow (and optionally block)
- Whether to enable immediately
S3-specific (optional):
STORAGE_AWS_EXTERNAL_ID— custom external ID for trust policy (auto-generated if omitted)STORAGE_AWS_OBJECT_ACL = 'bucket-owner-full-control'— for cross-account bucket accessUSE_PRIVATELINK_ENDPOINT = TRUE— for private connectivity
Azure-specific (optional):
USE_PRIVATELINK_ENDPOINT = TRUE— for private connectivity (not supported for OneLake)
Step 3: Create the Integration
Amazon S3:
CREATE STORAGE INTEGRATION <name>
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'S3'
STORAGE_AWS_ROLE_ARN = '<arn:aws:iam::123456789012:role/my-role>'
ENABLED = TRUE
STORAGE_ALLOWED_LOCATIONS = ('s3://<bucket>/<path>/');
Google Cloud Storage:
CREATE STORAGE INTEGRATION <name>
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'GCS'
ENABLED = TRUE
STORAGE_ALLOWED_LOCATIONS = ('gcs://<bucket>/<path>/');
Microsoft Azure:
CREATE STORAGE INTEGRATION <name>
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'AZURE'
AZURE_TENANT_ID = '<tenant-id>'
ENABLED = TRUE
STORAGE_ALLOWED_LOCATIONS = ('azure://<account>.blob.core.windows.net/<container>/<path>/');
Microsoft Fabric OneLake:
CREATE STORAGE INTEGRATION <name>
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'AZURE'
AZURE_TENANT_ID = '<tenant-id>'
ENABLED = TRUE
STORAGE_ALLOWED_LOCATIONS = ('azure://onelake.blob.fabric.microsoft.com/<workspace_id>/<item_id>/Files/<path>/');
Wildcard with blocked locations (allow all except specific paths):
CREATE STORAGE INTEGRATION <name>
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'S3'
STORAGE_AWS_ROLE_ARN = '<role-arn>'
ENABLED = TRUE
STORAGE_ALLOWED_LOCATIONS = ('*')
STORAGE_BLOCKED_LOCATIONS = ('s3://<sensitive-bucket>/');
Step 4: Complete the IAM Trust Relationship
After creating the integration, retrieve the generated IAM entity:
DESCRIBE STORAGE INTEGRATION <name>;
Then tell the user what to do next based on provider:
- S3: Copy
STORAGE_AWS_IAM_USER_ARNandSTORAGE_AWS_EXTERNAL_IDfrom the output. Update the IAM role's trust policy to allowsts:AssumeRolefrom this ARN with the external ID as a condition. - GCS: Copy
STORAGE_GCP_SERVICE_ACCOUNTfrom the output. Grant this service account thestorage.objectViewerrole (orstorage.objectAdminfor unloading) on the GCS bucket. - Azure / OneLake: Copy
AZURE_CONSENT_URLfrom the output. Open the URL in a browser to grant consent, then assign the Snowflake app theStorage Blob Data Reader(orContributor) role on the container.
Step 5: Verify Access
Create a test stage and list its contents:
CREATE STAGE <test_stage>
URL = '<cloud-url>'
STORAGE_INTEGRATION = <name>;
LIST @<test_stage>;
If LIST returns results, the integration is working.
Access Control
| Privilege | Object | Notes |
|---|---|---|
| CREATE INTEGRATION | Account | Only ACCOUNTADMIN has this by default. Can be granted to other roles. |
Important Constraints
CREATE OR REPLACEandIF NOT EXISTSare mutually exclusive — cannot use both.CREATE OR REPLACEbreaks all stages referencing the integration. If you must recreate, re-link every affected stage withALTER STAGE <stage> SET STORAGE_INTEGRATION = <name>.- Gov/China region storage requires a Snowflake account in the same region. Use
S3GOVorS3CHINAforSTORAGE_PROVIDER, notS3. - Cross-cloud/cross-region storage incurs per-byte transfer fees.
USE_PRIVATELINK_ENDPOINTis not supported for OneLake.- Each
STORAGE_BLOCKED_LOCATIONSURL must be individually quoted inside the parentheses.
Stopping Points
- Before
CREATE OR REPLACEon an existing integration: Warn user about stage breakage and recommend ALTER instead.