Google recently announced a new feature in preview called Volume Mounting. This feature is designed to streamline the integration of cloud-native applications with shared data storage solutions, such as Cloud Storage buckets and NFS shares, directly within your Cloud Run instance.
Volume mounting functionality is found in Cloud Run, a fully managed container platform built on Google’s scalable infrastructure. Google strengthens file system semantics and provides a more familiar experience for developers by allowing containers to access the content of storage buckets and file servers as if they were local. This eliminates the need for complex solutions and alternative services that were previously required to access shared data.
Examples of using volume mounts include storing application configuration files, handling event-driven Cloud Storage operations, loading vector database files for applications such as Langchain, and serving static websites more efficiently. For example, a developer can mount his Cloud Storage bucket to provide configuration to a service without having to rebuild and redeploy his container image on every update, or directly load static content from a website into a container. Now you can provide it. This flexibility is beneficial for applications that require regular static content or configuration updates.
Example of serving static content to a website (Source: Google Cloud blog post)
Another example is that volume mounting makes it easy to create event-driven Cloud Storage handlers, eliminating the need for custom code to fetch files from Cloud Storage. Mounting the relevant buckets streamlines the process by providing direct access to files through the file system.
Additionally, the ability to mount NFS storage such as Cloud Filestore instances is important for stateless services that rely on external databases such as ChromaDB. This ensures consistent access without embedding dynamically changing data within a container.
Developers can use gcloud commands to mount Cloud Storage buckets or any NFS file share, update Cloud Run YAML resource definitions, and deploy via Terraform. For example, you can use the following command to perform a source-based deployment to a new Cloud Run job and mount your Cloud Storage bucket.
gcloud beta run services update SERVICE \
--execution-environment gen2 \
--add-volume name=VOLUME_NAME,type=cloud-storage,bucket=BUCKET_NAME \
--add-volume-mount volume=VOLUME_NAME,mount-path=MOUNT_PATH
The introduction of volume mounts puts Google Cloud Run in competition with similar services from AWS and Azure. Integrating persistent storage volumes with AWS Fargate The mounting of Azure Files functionality in Azure Container Instances (ACI) highlights the industry’s move towards more flexible and scalable cloud services.
Etienne FontaineBlaBlaCar Site Reliability Engineer highlighted the competitive advantages of Google Cloud Run.he tweeted:
I think there’s a difference when you compare it to AWS with Fargate or EFS, for example.
To learn more about Google Cloud Run, visit our documentation website.