# Google Cloud Storage

Grant Send2Bucket’s Google service account write access to your Cloud Storage bucket. You don’t need to create or share a service account key.

## What you provide

- Settings: `bucket` and `prefix`, for example `analytics-raw` and `raw`.
- Send2Bucket's service account email, shown in the dashboard on the destination.

## 1. Grant access

Send2Bucket needs to create objects and to read the objects it wrote. Grant both roles on the bucket:

```bash
SA=<gcs_service_account>

gcloud storage buckets add-iam-policy-binding gs://analytics-raw \
  --member="serviceAccount:$SA" --role="roles/storage.objectCreator"

gcloud storage buckets add-iam-policy-binding gs://analytics-raw \
  --member="serviceAccount:$SA" --role="roles/storage.objectViewer"
```

To limit access to the prefix, add an IAM condition to each binding. Conditions need uniform bucket-level access.

```bash
--condition='expression=resource.name.startsWith("projects/_/buckets/analytics-raw/objects/raw/s2b/"),title=s2bucket-prefix'
```

## 2. Add the destination

Enter the bucket and the prefix in the dashboard and select Verify. Send2Bucket writes a test object under `raw/s2b/` and reads it back; the destination then becomes `active`.

For OpenTelemetry from SDKs or a Collector, see [Send OpenTelemetry to Google Cloud Storage](../guides/opentelemetry-to-gcs.md).

## How uploads are made safe to retry

Send2Bucket creates each object with an `ifGenerationMatch=0` precondition, so an upload never replaces an existing object. After an ambiguous response it reads the existing object and checks that it holds the same delivery batch before marking the batch delivered.

Objects use the layout in [Delivery format](../delivery-format.md).

## Query your data

- [BigQuery](../querying/bigquery.md): external table or scheduled load.
- [DuckDB](../querying/duckdb.md#google-cloud-storage): reads the objects in place with an HMAC key.
- [Trino](../querying/trino.md): external table over the bucket.
- [PostgreSQL](../querying/postgres.md): load into `jsonb`.
- [MySQL](../querying/mysql.md): load into `JSON`.
- [Python](../querying/python.md): Polars, PyIceberg or the duckdb package.
- [R](../querying/r.md): the duckdb package.
- [ClickHouse](../querying/clickhouse.md)
- [Snowflake](../querying/snowflake.md)
- [Microsoft Fabric](../querying/fabric.md)
- [Databricks](../querying/databricks.md)
- [Apache Spark](../querying/spark.md)

To explore in a notebook or BI tool, see [Integrations](../integrations/index.md). The [querying overview](../querying/index.md) compares engines.
