Configure an external volume for Google Cloud Storage

Grant Snowflake restricted access to a Google Cloud Storage (GCS) bucket using an external volume.

Prerequisites

Before you configure an external volume, you need the following:

  • A Google Cloud Storage bucket in the same region that hosts your Snowflake account.

  • Permissions in Google Cloud to create and manage IAM policies and roles. If you aren’t a Google Cloud administrator, ask your Google Cloud administrator to perform these tasks.

Step 1: Create an external volume in Snowflake

Create an external volume using the CREATE EXTERNAL VOLUME command.

Note

Only account administrators (users with the ACCOUNTADMIN role) can execute this SQL command.

The following example creates an external volume that defines a single GCS storage location with encryption:

CREATE EXTERNAL VOLUME my_gcs_external_volume
  STORAGE_LOCATIONS =
    (
      (
        NAME = 'my-us-west-2'
        STORAGE_PROVIDER = 'GCS'
        STORAGE_BASE_URL = 'gcs://mybucket1/path1/'
        ENCRYPTION=(TYPE='GCS_SSE_KMS' KMS_KEY_ID = '1234abcd-12ab-34cd-56ef-1234567890ab')
      )
    );
Copy

Step 2: Retrieve the GCS service account for your Snowflake account

To retrieve the ID for the GCS service account that was created automatically for your Snowflake account, use the DESCRIBE EXTERNAL VOLUME command. Specify the name of the external volume that you created previously.

For example:

DESC EXTERNAL VOLUME my_gcs_external_volume;
Copy

Record the value of the STORAGE_GCP_SERVICE_ACCOUNT property in the output (for example, service-account-id@project1-123456.iam.gserviceaccount.com).

Snowflake provisions a single GCS service account for your entire Snowflake account. All GCS external volumes use that service account.

Step 3: Grant the service account permissions to access bucket objects

In this step, you configure IAM access permissions for Snowflake in your Google Cloud console.

Create a custom IAM role

Create a custom role that has the permissions required to access the bucket and get objects.

  1. Log in to the Google Cloud console as a project editor.

  2. From the home dashboard, select IAM & Admin » Roles.

  3. Select Create Role.

  4. Enter a Title and optional Description for the custom role.

  5. Select Add Permissions.

  6. In Filter, select Service and then select storage.

  7. Filter the list of permissions, and add the following from the list:

    • storage.buckets.get

    • storage.objects.create

    • storage.objects.delete

    • storage.objects.get

    • storage.objects.list

  8. Select Add.

  9. Select Create.

Assign the custom role to the GCS service account

  1. Log in to the Google Cloud console as a project editor.

  2. From the home dashboard, select Cloud Storage » Buckets.

  3. Filter the list of buckets, and select the bucket that you specified when you created an external volume.

  4. Select Permissions » View by principals, then select Grant access.

  5. Under Add principals, paste the name of the service account name from the output in Step 2: Retrieve the GCS service account for your Snowflake account.

  6. Under Assign roles, select the custom IAM role that you created previously, then select Save.

Grant the GCS service account permissions on the Google Cloud Key Management Service keys

Note

This step is required only if your GCS bucket is encrypted using a key stored in the Google Cloud Key Management Service (Cloud KMS).

  1. Log in to the Google Cloud console as a project editor.

  2. From the home dashboard, search for and select Security » Key Management.

  3. Select the key ring that is assigned to your GCS bucket.

  4. In the upper-right corner, select SHOW INFO PANEL. The information panel for the key ring appears.

  5. In the Add members field, search for the service account name from the DESCRIBE EXTERNAL VOLUME output in Step 2: Retrieve the GCS service account for your Snowflake account.

  6. From the Select a role dropdown, select the Cloud KMS CryptoKey Encrypter/Decrypter role.

  7. Select Add. The service account name is added to the Cloud KMS CryptoKey Encrypter/Decrypter role dropdown in the information panel.

Step 4: Verify storage access

To check that Snowflake can successfully authenticate to your storage provider, call the SYSTEM$VERIFY_EXTERNAL_VOLUME function.

SELECT SYSTEM$VERIFY_EXTERNAL_VOLUME('my_s3_external_volume');
Copy

Next steps

After you configure an external volume, you can create an Iceberg table.

Language: English