# Serving files from Google Cloud Storage

imgproxy can process images from Google Cloud Storage buckets. To use this feature, do the following:

1. Set the `IMGPROXY_USE_GCS` environment variable to `true`.
2. [Set up credentials](#setup-credentials) to grant access to your bucket.
3. _(optional)_ Specify the Google Cloud Storage endpoint with `IMGPROXY_GCS_ENDPOINT`.
4. Use `gs://%bucket_name/%file_key` as the source image URL.

If you need to specify generation of the source object, you can use the query string of the source URL:

```
gs://%bucket_name/%file_key?%generation
```

:::tip
If filenames in your Google Cloud Storage may contain `?`, you may want to set [IMGPROXY_SOURCE_URL_QUERY_SEPARATOR](../configuration/options.mdx#IMGPROXY_SOURCE_URL_QUERY_SEPARATOR) to another string that is not used in filenames or set it to blank to disable query string extraction.

For example, if you set `IMGPROXY_SOURCE_URL_QUERY_SEPARATOR` to `?generation=`, you can specify the generation like this:

```
gs://%bucket_name/%file_key?generation=%generation
```
:::

### Setup credentials

If you run imgproxy inside Google Cloud infrastructure (Compute Engine, Kubernetes Engine, App Engine, and Cloud Functions, etc), and you have granted access to your bucket to the service account, you probably don't need to do anything here. imgproxy will try to use the credentials provided by Google.

Otherwise, set `IMGPROXY_GCS_KEY` environment variable to the content of Google Cloud JSON key. Get more info about JSON keys: [https://cloud.google.com/iam/docs/creating-managing-service-account-keys](https://cloud.google.com/iam/docs/creating-managing-service-account-keys).

---

## Navigation

- [Getting started](/3.29.x/getting_started)
- [imgproxy Pro](https://imgproxy.net#pro)
- [Installation](/3.29.x/installation)
- [Configuration](/3.29.x/category/configuration)
  - [Configuration options](/3.29.x/configuration/options)
  - [Loading environment variables](/3.29.x/configuration/loading_environment_variables)
- [Usage](/3.29.x/category/usage)
  - [Processing an image](/3.29.x/usage/processing)
  - [Getting an image info](/3.29.x/usage/getting_info)
  - [Signing a URL](/3.29.x/usage/signing_url)
  - [Encrypting a source URL](/3.29.x/usage/encrypting_source_url)
  - [Presets](/3.29.x/usage/presets)
- [Features](/3.29.x/category/features)
  - [Watermark](/3.29.x/features/watermark)
  - [Object detection](/3.29.x/features/object_detection)
  - [Autoquality](/3.29.x/features/autoquality)
  - [Best format](/3.29.x/features/best_format)
  - [Chained pipelines](/3.29.x/features/chained_pipelines)
- [Image sources](/3.29.x/category/image-sources)
  - [Serving local files](/3.29.x/image_sources/local_files)
  - [Serving files from Amazon S3](/3.29.x/image_sources/amazon_s3)
  - [Serving files from Google Cloud Storage](/3.29.x/image_sources/google_cloud_storage)
  - [Serving files from Azure Blob Storage](/3.29.x/image_sources/azure_blob_storage)
  - [Serving files from OpenStack Object Storage ("Swift")](/3.29.x/image_sources/openstack_swift)
- [Monitoring](/3.29.x/category/monitoring)
  - [New Relic](/3.29.x/monitoring/new_relic)
  - [Prometheus](/3.29.x/monitoring/prometheus)
  - [Datadog](/3.29.x/monitoring/datadog)
  - [OpenTelemetry](/3.29.x/monitoring/open_telemetry)
  - [Amazon CloudWatch](/3.29.x/monitoring/cloud_watch)
- [Image formats support](/3.29.x/image_formats_support)
- [About the processing pipeline](/3.29.x/about_processing_pipeline)
- [Health check](/3.29.x/healthcheck)
- [Memory usage tweaks](/3.29.x/memory_usage_tweaks)

## Other versions

- [4.0.x (current)](/image_sources/google_cloud_storage)
- [latest (unstable)](/latest/image_sources/google_cloud_storage)
- [3.31.x](/3.31.x/image_sources/google_cloud_storage)
- [3.30.x](/3.30.x/image_sources/google_cloud_storage)
- [3.28.x](/3.28.x/image_sources/google_cloud_storage)
- [3.27.x](/3.27.x/image_sources/google_cloud_storage)
- [3.26.x](/3.26.x/image_sources/google_cloud_storage)
- [3.25.x](/3.25.x/image_sources/google_cloud_storage)
- [3.24.x](/3.24.x/image_sources/google_cloud_storage)
- [3.23.x](/3.23.x/image_sources/google_cloud_storage)
- [3.22.x](/3.22.x/image_sources/google_cloud_storage)
- [3.21.x](/3.21.x/image_sources/google_cloud_storage)
- [3.20.x](/3.20.x/image_sources/google_cloud_storage)
- [3.19.x](/3.19.x/image_sources/google_cloud_storage)
