Select spec version:

Google Cloud Storage Destination Config Reference Beta

Complete Rudder CLI reference for the Google Cloud Storage destination config keys, source types, and secrets.
Available Plans
  • free
  • growth
  • enterprise

Google Cloud Storage is an object storage destination. RudderStack batches events and writes them as files into a GCS bucket you own.

In a Google Cloud Storage destination spec:

  • type: gcs
  • definition_version: 1

Sample configuration

yaml
version: rudder/v1
kind: destination
metadata:
  name: gcs-events-prod
spec:
  id: gcs-events-prod
  display_name: GCS Events Production
  type: gcs
  definition_version: 1
  enabled: true
  config:
    bucket_name: rudder-events-prod
    prefix: rudder/events
    credentials: "{{ .GCS_CREDENTIALS }}"

    connection_mode:
      web: cloud
      cloud: cloud
    consent_management:
      web:
        - provider: oneTrust
          consents:
            - analytics

The above example supplies the service account key through a variable, which is how you should always set credentials — see Secrets.

Config keys

config accepts only the keys listed below. The shared config key rules cover unknown keys, defaults, and immutability.

Bucket

bucket_name

Required

Type: string

Description: Name of the GCS bucket RudderStack writes event files to. The bucket must already exist.

Notes:

  • At most 100 characters, and must not contain line breaks.
  • A {{ path || fallback }} template is accepted in place of a literal, and isn’t measured against the length limit.

prefix

Type: string

Description: Folder prefix inside the bucket. RudderStack writes all files beneath it.

Notes:

  • At most 100 characters, and must not contain line breaks.
  • Templates are accepted on the same terms as bucket_name.

Authentication

credentials

Secret

Type: string

Description: Contents of the JSON key file for a GCP service account that can create objects in the bucket.

Notes:

  • Rudder CLI doesn’t require this key and doesn’t validate its content.

Supply it as a {{ .VAR }} reference rather than a literal — see Secrets.

See Setting up Google Cloud Storage for how to create the service account and its key.

Per-source keys

Both keys are objects keyed by the local source type — the tokens listed under Source types. A key naming a source type this destination doesn’t support fails validation.

connection_mode

Type: object

Description: Maps each source type you connect to the mode its events reach GCS in, using the modes in Source types.

Notes:

yaml
connection_mode:
  web: cloud
  cloud: cloud

Source types

Google Cloud Storage accepts events from these source types in the mentioned connection modes:

Source typeConnection mode
androidcloud
android_kotlincloud
ioscloud
ios_swiftcloud
webcloud
unitycloud
react_nativecloud
fluttercloud
cordovacloud
cloudcloud

Every source type is cloud only — events reach the bucket from RudderStack’s servers, never in device mode.

The dashboard additionally offers Google Cloud Storage to AMP, Shopify, and Reverse ETL sources. Rudder CLI doesn’t manage those connections, so amp, shopify, and warehouse are invalid here.

Connect a source

An event stream connection to this destination is checked against two rules at validate time.

The source’s type must be supported. A source’s type resolves to one of the tokens above before the check — a JavaScript source resolves to web, and webhook and server-side SDK sources resolve to cloud. An unsupported type reports:

destination 'gcs-events-prod' (type 'gcs') does not support source 'my-source':
source type 'amp' is not among supported source types: android, android_kotlin, ...

The destination config must carry a connection_mode entry for that source type. This lives on the destination spec, not on the connection spec. Without it:

destination 'gcs-events-prod' config has no 'connection_mode' entry for source type 'web'

Google Cloud Storage needs no additional config keys to connect a source of any type.

Secrets

credentials is the only secret key. Write it as a {{ .VAR }} reference and supply the value at apply time:

yaml
config:
  credentials: "{{ .GCS_CREDENTIALS }}"
bash
export RUDDER_GCS_CREDENTIALS="$(cat service-account.json)"
rudder-cli apply

# or
rudder-cli apply --var-file secrets.vars.yaml

Note that:

  • The YAML that rudder-cli import writes may or may not include secret keys. Before you apply, make sure every secret key your configuration needs is present and populated through variable substitution.

See How to Use Variable Substitution in Rudder CLI.

See more

Questions? Let's figure it out together.

Join the RudderStack Slack community to connect with other users, customers, and the RudderStack team — or reach out for direct support.