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

  1. Create an IAM policy with S3 read (and write if unloading)
  2. Create an IAM role with that policy and a temporary trust policy
  3. CREATE STORAGE INTEGRATION with the role ARN and allowed locations
  4. DESC INTEGRATION to get the IAM user ARN and external ID
  5. Update the role's trust policy with those two values
  6. 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.
  7. 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 topics

Snowflake Fundamentals

Warehouses & Performance

Staging & SnowSQL

Tables & Data Handling

Cloud Integrations

Storage & Optimization

Security & Governance

Views, Pipelines & Automation

Data Types & SQL Fundamentals

Semi-Structured Data Deep Dive

Advanced Features

Data Sharing & Collaboration

Cost Management & Monitoring

Databases, Schemas & Objects

Performance Deep Dive

Advanced Security & Governance

Stored Procedures & UDFs

Ecosystem & Integrations

SnowPro Certification Prep

T
Tech Town
Log InSign Up Free
Home SQL Python DSA Power BI Snowflake Databricks Spark Gen AI Practice Problems Contest Blog

Mastering Snowflake

The modern data cloud, from architecture to SnowPro certification. Click any topic in the sidebar to open it right here.

{{ sectionCount }}
Sections
{{ topicCount }}
Topics
Free
Forever
Hands-on practice Practice Snowflake SQL Sharpen the SQL you use in Snowflake: 150 query problems in a live editor with instant checking. Start practising →
Section {{ sec.num }}

{{ sec.label }}

Snowflake  /  {{ current.sectionLabel }}  /  {{ current.name }}

{{ current.name }}

Theory

{{ current.def }}

Why we use it

{{ rich.why }}

When to use it

{{ rich.when }}

{{ sec.h }}

{{ sec.body }}

{{ sec.body }}

Diagram

{{ rich.dg.caption }}

{{ tb.title }}
{{ c.v }}
{{ rich.dg.op }}
➜
{{ rich.dg.output.title }}
{{ c.v }}
{{ nd.label }}
{{ nd.sub }}
{{ nd.label }}
{{ nd.sub }}
{{ rich.dg.left.title }}
{{ it }}
{{ rich.dg.right.title }}
{{ it }}
On screen — where to click

{{ rich.ui.title }}

{{ u.text }}
  1. {{ st.n }}{{ st.text }}
{{ rich.ui.title }}
{{ u.text }}
Flowchart — how it works
{{ nd.text }}
{{ nd.text }}
◇ {{ nd.text }}
Yes → {{ nd.yes }}
No → {{ nd.no }}
Syntax
{{ current.syntax }}
Example
{{ current.example }}
Want to run this yourself? Unlike the SQL and Python courses, Snowflake needs a real account — there's no in-browser engine for it. Click Copy above, then paste it into a free Snowflake trial (30 days, no card required) and run it in Snowsight.
Key Points — click to check off as you learn
  • {{ pt.mark }} {{ pt.text }}

Share this topic