# Internal cache: Google Cloud Storage

imgproxy can store cached images in Google Cloud Storage buckets. To use the GCS cache, do the following:

1. Set the `IMGPROXY_CACHE_USE` environment variable to `gcs`.
2. [Set up credentials](#setup-credentials) to grant access to your cache bucket.
3. Specify the cache bucket name with `IMGPROXY_CACHE_BUCKET`.
4. _(optional)_ Specify the Google Cloud Storage endpoint with `IMGPROXY_CACHE_GCS_ENDPOINT`.

### Configuration

* `IMGPROXY_CACHE_USE`: set to `gcs` to enable Google Cloud Storage cache.
* `IMGPROXY_CACHE_BUCKET`: the GCS bucket name for cache storage. Default: blank
* `IMGPROXY_CACHE_GCS_KEY`: the Google Cloud JSON key for cache access. When running on Google Cloud infrastructure, imgproxy will use the default service account credentials if none are set. Default: blank
* `IMGPROXY_CACHE_GCS_ENDPOINT`: a custom Google Cloud Storage endpoint for cache. Default: blank
* `IMGPROXY_CACHE_PATH_PREFIX`: a path prefix for the cache files. Default: blank
* `IMGPROXY_CACHE_KEY_HEADERS`: a comma-separated list of HTTP request headers to include in the cache key. Default: blank
* `IMGPROXY_CACHE_KEY_COOKIES`: a comma-separated list of HTTP request cookies to include in the cache key. Default: blank
* `IMGPROXY_CACHE_REPORT_ERRORS`: when `true`, imgproxy will report cache errors instead of silently falling back to processing without cache. Default: `false`

### Setup credentials

If you run imgproxy inside Google Cloud infrastructure (Compute Engine, Kubernetes Engine, App Engine, Cloud Functions, etc), and you have granted access to your cache 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 the `IMGPROXY_CACHE_GCS_KEY` environment variable to the content of the 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).

:::warning
For security reasons, imgproxy accepts only service account keys for Google Cloud Storage cache integration.
:::

---

## Navigation

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

## Other versions

- [4.0.x (current)](/cache/internal/google_cloud_storage)
