Configure an external volume for S3-compatible storage

For externally managed Iceberg tables with data and metadata in S3-compatible storage, you can configure an external volume associated with an Amazon S3-compatible storage location.

Iceberg tables that use S3-compatible storage are cross-region tables and don’t support the following actions:

Prerequisites

To create an Iceberg table that uses S3-compatible storage, you must have an S3-compatible API endpoint for Snowflake. For more information, see Requirements for S3-compatible storage.

Create an external volume for S3-compatible storage

The following steps demonstrate how to configure an external volume for S3-compatible storage and how to use that volume to create an externally managed Iceberg table.

  1. Create an external volume that specifies an S3-compatible storage location. For information about the S3-compatible parameters in the CREATE EXTERNAL VOLUME command, see the command syntax.

    CREATE OR REPLACE EXTERNAL VOLUME ext_vol_s3_compat
      STORAGE_LOCATIONS = (
        (
          NAME = 'my_s3_compat_storage_location'
          STORAGE_PROVIDER = 'S3COMPAT'
          STORAGE_BASE_URL = 's3compat://mybucket/unload/mys3compatdata'
          CREDENTIALS = (
            AWS_KEY_ID = '1a2b3c...'
            AWS_SECRET_KEY = '4x5y6z...'
          )
          STORAGE_ENDPOINT = 'mystorage.com'
        )
      )
      ALLOW_WRITES = FALSE;
    
    Copy
  2. If you don’t have a catalog integration, create one for your Iceberg table. Iceberg tables that use S3-compatible storage are only supported when you use a catalog integration. For more information, see Create a catalog integration.

    The following example creates a catalog integration for Iceberg files in object storage.

    CREATE OR REPLACE CATALOG INTEGRATION my_iceberg_catalog_int
      CATALOG_SOURCE = OBJECT_STORE
      TABLE_FORMAT = ICEBERG
      ENABLED = TRUE;
    
    Copy
  3. Use the external volume and catalog integration to create an Iceberg table.

    For example:

    CREATE ICEBERG TABLE my_iceberg_table
      EXTERNAL_VOLUME = 'ext_vol_s3_compat'
      CATALOG = 'my_iceberg_catalog_int'
      METADATA_FILE_PATH = 'path/to/metadata/v1.metadata.json';
    
    Copy

Update your external volume credentials

To change or update the credentials for the external volume, you can use the ALTER EXTERNAL VOLUME … UPDATE command. Specify the name of the storage location that you want to change the credentials for.

ALTER EXTERNAL VOLUME ext_vol_s3_compat UPDATE
  STORAGE_LOCATION = 'my_s3_compat_storage_location'
  CREDENTIALS = (
    AWS_KEY_ID = '4d5e6f...'
    AWS_SECRET_KEY = '7g8h9i...'
  );
Copy