LEARN HOW TO PREPARE YOUR DATA WAREHOUSE FOR AGENTIC AI WORKLOADSRegister for the webinar

Skip to main content

Google Cloud Storage

With MotherDuck, you can access files in a private Google Cloud Storage (GCS) bucket. This leverages the GCS S3 compatible connection.

Google Cloud Storage Connection Process

  1. Create an HMAC key for the service account: Cloud Storage → Settings → Interoperability → Create a key for a service account
  2. Save the Access ID and Secret (shown once)
  3. Create the DuckDB secret using the HMAC credentials as described below

Configure Google Cloud Storage credentials

You can safely store your Google Cloud Storage credentials in MotherDuck for convenience by creating a SECRET object using the CREATE SECRET command.

Create a SECRET object

You can safely store your Google Cloud Storage credentials in MotherDuck for convenience by creating a SECRET object using the CREATE SECRET command.

CREATE SECRET IN MOTHERDUCK (
TYPE GCS,
KEY_ID 'HMAC_ACCESS_ID',
SECRET 'HMAC_SECRET',
);

-- test GCS credentials
SELECT count(*) FROM 'gcs://<bucket>/<file>';

You can update your secret by executing CREATE OR REPLACE SECRET command to overwrite your secret.

Delete a SECRET object

You can use the same method above, using the DROP SECRET command.

DROP SECRET <secret_name>;

Google Cloud Storage credentials as temporary secrets

MotherDuck supports DuckDB syntax for providing GCS credentials.

CREATE SECRET (
TYPE GCS,
KEY_ID 's3_access_key',
SECRET 's3_secret_key'
);
note

Local/In-memory secrets are not persisted across sessions.

Additional resources