Configure an external volume¶
An external volume is a named, account-level Snowflake object that you use to connect Snowflake to your external cloud storage for Iceberg tables. An external volume stores an identity and access management (IAM) entity for your storage location. Snowflake uses the IAM entity to securely connect to your storage for accessing table data, Iceberg metadata, and manifest files that store the table schema, partitions, and other metadata.
A single external volume can support one or more Iceberg tables.
You must create an external volume before you can create an Apache Iceberg™ table in Snowflake.
Create an external volume¶
The steps to create an external volume depend on your cloud storage provider.
For instructions, see the following topics:
Each external volume is associated with a particular Active storage location, and a single external volume can support multiple Iceberg tables. However, the number of external volumes you need depends on how you want to store, organize, and secure your table data.
You can use a single external volume if you want the data and metadata for all of your Snowflake-Iceberg tables in subdirectories under the same storage location (for example, in the same S3 bucket). To configure these directories for Snowflake-managed tables, see Data and metadata directories.
Alternatively, you can create multiple external volumes to secure various storage locations differently. For example, you might create the following external volumes:
A read-only external volume for externally managed Iceberg tables.
An external volume configured with read and write access for Snowflake-managed tables.
Verify an external volume¶
To check that Snowflake can successfully authenticate to your storage provider using an external volume that you’ve configured, call the SYSTEM$VERIFY_EXTERNAL_VOLUME function.
Specify the name of the external volume that you want to verify.
SELECT SYSTEM$VERIFY_EXTERNAL_VOLUME('my_s3_external_volume');
Set a default external volume at the account, database, or schema level¶
To set an existing external volume as the default to use for Iceberg tables, you can set the EXTERNAL_VOLUME parameter at the following levels:
- Account:
Account administrators can use the ALTER ACCOUNT command to set the parameter for the account. If the value is set for the account, all Iceberg tables created in the account read from and write to this external volume by default.
- Object:
Users can execute the appropriate CREATE <object> or ALTER <object> command to override the EXTERNAL_VOLUME parameter value at the database or schema level. The lowest-scoped declaration is used: schema > database > account.
In addition to the minimum privileges required to modify an object using the appropriate ALTER <object_type> command, a role must have the USAGE privilege on the external volume.
Note
Changes to the EXTERNAL_VOLUME parameter only apply to tables created after the change. Existing tables continue to use the external volume specified when they were created.
Example¶
The following statement sets an external volume (my_s3_vol
) for a database named my_database_1
:
ALTER DATABASE my_database_1
SET EXTERNAL_VOLUME = 'my_s3_vol';
After setting an external volume at the database level, you can create an Iceberg table in that database
without specifying an external volume. The following statement creates an Iceberg table in my_database_1
that uses Snowflake as the catalog and uses the default external volume (my_s3_vol
) set for the database.
CREATE ICEBERG TABLE iceberg_reviews_table (
id STRING,
product_name STRING,
product_id STRING,
reviewer_name STRING,
review_date DATE,
review STRING
)
CATALOG = 'SNOWFLAKE'
BASE_LOCATION = 'my/product_reviews/';