> ## Documentation Index
> Fetch the complete documentation index at: https://artie.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Cloud Storage

> How to configure [Google Cloud Storage (GCS)](https://cloud.google.com/storage) as a destination in Artie. With GCS, Artie will write incoming delta files in Parquet format to the specified bucket and folder.

## Required settings

* Project ID
* Service account
* Bucket name

## Optional settings

* Optional prefix
* Table name <Tooltip tip="Artie will write the fully qualified table name into the bucket (e.g: db/schema/table), you can control the separator between the parts">separator (default: "/")</Tooltip>

### Bucket structure

Artie will write all the delta files into a GCS bucket. The bucket structure will be as follows:

```
-- tableName will be the fully qualified table name (db.schema.tableName)
/{{bucketName}}/{{prefix}}/{{tableName}}/{{YYYY-MM-DD}}/{{unixTimestampMs}}_{{randomString(4)}}.parquet.gz

-- example
/artie/foo/db.schema.tableName/2023-08-06/1654320000000_abc1.parquet.gz
```

<Accordion title="Service account script">
  ```hcl theme={null}
  provider "google" {
    project = "your-gcp-project-id"
    region  = "us-central1"
  }

  resource "google_service_account" "artie_transfer" {
    account_id   = "artie-transfer"
    display_name = "Artie Transfer Service Account"
    description  = "Service account for Artie to write to GCS"
  }

  resource "google_storage_bucket_iam_member" "bucket_object_admin" {
    bucket = "your-bucket-name"
    role   = "roles/storage.objectAdmin"
    member = "serviceAccount:${google_service_account.artie_transfer.email}"
  }

  resource "google_storage_bucket_iam_member" "bucket_viewer" {
    bucket = "your-bucket-name"
    role   = "roles/storage.bucketViewer"
    member = "serviceAccount:${google_service_account.artie_transfer.email}"
  }

  resource "google_service_account_key" "artie_transfer_key" {
    service_account_id = google_service_account.artie_transfer.name
  }

  output "service_account_email" {
    value = google_service_account.artie_transfer.email
  }

  output "service_account_key" {
    value     = base64decode(google_service_account_key.artie_transfer_key.private_key)
    sensitive = true
  }
  ```
</Accordion>
