> For the complete documentation index, see [llms.txt](https://mercure-technologies.gitbook.io/expo-open-ota/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://mercure-technologies.gitbook.io/expo-open-ota/storage/google-cloud-storage.md).

# Google Cloud Storage

Use Google Cloud Storage (GCS) to store and deliver update assets.

### Configure storage

Set these environment variables:

```dotenv
STORAGE_MODE=gcs
GCS_BUCKET_NAME=your-bucket-name
GOOGLE_APPLICATION_CREDENTIALS_B64=<base64-encoded service account JSON>
```

### Create service account credentials

{% stepper %}
{% step %}

#### Create a service account

In the GCP Console, go to **IAM & Admin** → **Service Accounts**.

Create a service account or select an existing one.
{% endstep %}

{% step %}

#### Grant bucket access

Go to **Cloud Storage** → **Buckets** and select your bucket.

Open **Permissions**, then select **Grant Access**. Add the service account with the **Storage Admin** role.
{% endstep %}

{% step %}

#### Create and encode a key

Go to **Service Accounts** → **Keys** → **Add Key** → **Create new key**.

Choose **JSON**, then encode the downloaded file:

```shellscript
base64 -i /path/to/service-account.json | tr -d '\n'
```

Set the result as `GOOGLE_APPLICATION_CREDENTIALS_B64`.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
The credential authenticates object operations and generates signed URLs.
{% endhint %}

### Asset delivery

GCS delivers assets through direct signed URLs. Each URL expires after 15 minutes.

When a client requests an update asset, the server redirects it to GCS. The server still serves the file content itself when the client sends the `prevent-cdn-redirection: true` header, or when no `GOOGLE_APPLICATION_CREDENTIALS_B64` is configured.

{% hint style="success" %}
Signed URLs are enabled automatically when `GOOGLE_APPLICATION_CREDENTIALS_B64` is set. No CDN configuration is required.
{% endhint %}

{% hint style="info" %}
CloudFront takes precedence when its domain, key pair ID, and private key are configured.
{% endhint %}

### Required permissions

Grant the service account the **Storage Admin** role on the bucket. It provides:

* `storage.objects.get` — Read objects.
* `storage.objects.list` — List branches, runtime versions, and updates.
* `storage.objects.create` — Upload updates.
* `storage.objects.delete` — Remove updates.
* Signed URL generation — Deliver assets directly from GCS.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://mercure-technologies.gitbook.io/expo-open-ota/storage/google-cloud-storage.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
