IAM Role & Storage Integration
Snowflake · Cloud Integrations
Theory
A storage integration is a Snowflake object that stores an identity for external cloud storage. For AWS it holds the ARN of an IAM role in your account. When you run DESC INTEGRATION, Snowflake shows two values: STORAGE_AWS_IAM_USER_ARN, the Snowflake-side IAM user, and STORAGE_AWS_EXTERNAL_ID. You paste both into the IAM role's trust policy so only that Snowflake identity, with that external ID, can assume the role.
After that, any stage created WITH STORAGE_INTEGRATION = s3_int uses short-lived credentials from the role. Revoking access is a change in AWS, and there are no long-lived keys to rotate.
Why we use it
Access keys typed into CREATE STAGE end up in scripts, query history and repos, and must be rotated by hand. A role-based integration keeps secrets out of Snowflake SQL and lets the AWS team control access centrally.
When to use it
Use a storage integration for every production S3 stage. Creating it needs ACCOUNTADMIN or the CREATE INTEGRATION privilege; then grant USAGE on it to the roles that create stages.
Why Not Just Use Access Keys
Long-lived AWS access keys embedded in SQL are a security liability — they don't expire on their own and are easy to leak into logs or version control.
How a Storage Integration Works
Instead, Snowflake assumes an IAM role you configure, using a trust policy and an external ID that Snowflake generates — access can be revoked centrally in AWS at any time.
Setup Order Matters
You create the storage integration in Snowflake first to get the external ID, then create the IAM role in AWS with that ID in its trust policy — doing it in the wrong order is the most common setup mistake.
How it works
- Create an IAM policy with S3 read (and write if unloading)
- Create an IAM role with that policy and a temporary trust policy
- CREATE STORAGE INTEGRATION with the role ARN and allowed locations
- DESC INTEGRATION to get the IAM user ARN and external ID
- Update the role's trust policy with those two values
- Does a stage using the integration LIST files? Yes: Grant USAGE on the integration to loader roles. No: Recheck the trust policy and S3 paths.
- Stages now use short-lived role credentials
Example
CREATE STORAGE INTEGRATION s3_int
TYPE = EXTERNAL_STAGE
STORAGE_PROVIDER = 'S3'
STORAGE_AWS_ROLE_ARN = 'arn:aws:iam::...';Key points
- Snowflake generates an IAM user ARN and external ID for your trust policy
- The trust policy on the IAM role points back to that Snowflake identity
- Removes the need to rotate long-lived access keys
- Recreating the integration changes the external ID; update the trust policy
- Grant USAGE on the integration to roles that create stages