Pimcore guides &amp; How to 2 min read

# How to set up Pimcore to use Google Cloud storage service

Learn the best practice for setting up Pimcore to use Google Cloud Storage in our short guide!

Last updated on 29 August, 2025

## Key takeaways

1. Pimcore can automatically copy uploaded files to Google Cloud Storage, so other services can access them or the cloud copy serves as a backup.
2. The setup installs the Google Cloud Storage client library, adds a custom startup.php, configures event listeners and adds a listener class that responds to file events.
3. Pimcore's storage locations are customized in a constants.php file, and existing asset content is migrated to the bucket with the gsutil rsync tool.
4. Deleting a file in Pimcore administration also deletes it from Google Cloud Storage, but deleting it in the cloud does not remove it from Pimcore.

## **What you’ll learn with this guide**

This guide will show you how to set up Pimcore to use the Google Cloud Storage service. Google Cloud Storage SDK and stream wrapper will be used. The guide is based on [Pimcore documentation for Amazon AWS Storage Setup](https://pimcore.com/docs/pimcore/current/Development_Documentation/Installation_and_Upgrade/System_Setup_and_Hosting/Amazon_AWS_Setup/Amazon_AWS_S3_Setup.html).

## **Where to use**

Assume you want to upload files to your Pimcore application, but for some reason, be it that other applications or services need to access those same files via Google Cloud Storage or you just want to have a backup of your files saved on the cloud, you want the process of uploading files to Google Cloud Storage to be automated. You only want to upload a file to Pimcore and let it handle uploading the same file to Google Cloud Storage by itself. To achieve this, a bit of coding is needed which will be shown in this guide.

## **Solution**

In this guide, it is assumed that you are familiar with Google Cloud Storage, you have a bucket on the cloud and you downloaded a JSON file containing mainly your private key, but other useful data as well.
 **The solution consists of the following steps:**

1. Install Google Cloud Storage Client Library
2. Create a custom startup.php
3. Configure the Event Listeners
4. Add a class to respond to the events
5. Customize the storage locations of Pimcore
6. Migrate the existing content

### **1. Install Google Cloud Storage Client Library**

Run the following command in your Pimcore document root:

### **2. Create a custom startup.php**

Create a new file (or re-use existing) with the following code in /app/startup.php:

### **3. Configure the Event Listeners**

Create a new file (or re-use existing) with the following code in /app/config/services.yml:

### **4. Add a class to respond to the events**

Create a new file named /GoogleCloudStorageListener.php with the following code in your bundle source: ***/src/CommonBundle/EventListener/GoogleCloudStorageListener.php***

Create a new file named /GoogleCloudStorageListener.php with the following code in your bundle source: ***/src/CommonBundle/EventListener/GoogleCloudStorageListener.php***

### **5. Customize the Storage Locations of Pimcore**

Create a new file named ***/constants.php in /app/constants.php*** and put the following code in it:

### **6. Migrate Existing Content**

Migrating existing content from Pimcore application directories to Google Cloud Storage is done by using gsutil tool. Run the following command from your Pimcore root directory to copy the contents of Pimcore application’s assets directory to your bucket on Google Cloud Storage.

Here’s the official documentation for [gsutil installation](https://cloud.google.com/storage/docs/gsutil_install) and [gsutil rsync usage](https://cloud.google.com/storage/docs/gsutil/commands/rsync). You’ll most certainly find it useful!

## **Does it work?**

Visit your Pimcore administration and try to upload a file, the file should be uploaded and visible in Pimcore administration as well as Google Cloud Storage.

Deleting a file in Pimcore administration results in deletion of the file on the cloud. Vice versa does not apply

## **Do you have more questions, or having issues while implementing this? Reach out to us; we’ll be glad to help!**

## Related

[Pimcore guides &amp; How to **Pimcore Studio Setup Guide: Backend &amp; Infrastructure for Developers** Step-by-step overview of Pimcore Studio backend setup, including required services, DDEV configuration, bundle installation, indexing, and production considerations. 34 min read](https://factory.dev/pimcore-knowledge-base/tutorial/pimcore-studio-setup-guide-backend-infrastructure) [Pimcore guides &amp; How to **Customizing Pimcore Classification Store: Removing Grid View Duplicates and Simplifying DataHub Imports** Shared Classification Store attributes can clutter Pimcore grid views and make DataHub imports harder to maintain. This article shows how a custom implementation creates one logical attribute view… 10 min read](https://factory.dev/pimcore-knowledge-base/how-to/customizing-pimcore-classification-store) [Pimcore guides &amp; How to **Using named API routes in separated Vue CLI generated Applications** Discover how to use named, and exposed routes via Symfony FOSJsRoutingBundle in separated Vue CLI generated Applications. 2 min read](https://factory.dev/pimcore-knowledge-base/how-to/named-api-routes-in-separated-vue-cli-generated-applications)

---

Source: https://factory.dev/pimcore-knowledge-base/how-to/pimcore-google-cloud-storage-service
