GOOGLE-PROFESSIONAL-CLOUD-DEVELOPER practice question 12 of 35

You are working on a social media application. You plan to add a feature that allows users to upload images. These images will be 2 MB – 1 GB in size. You want to minimize their infrastructure operations overhead for this feature. What should you do?

Full set: 265 questions
Answer options
A: Change the application to accept images directly and store them in the database that stores other user information.
B: Change the application to create signed URLs for Cloud Storage. Transfer these signed URLs to the client application to upload images to Cloud Storage. Correct answer
C: Set up a web server on GCP to accept user images and create a file store to keep uploaded files. Change the application to retrieve images from the file store.
D: Create a separate bucket for each user in Cloud Storage. Assign a separate service account to allow write access on each bucket. Transfer service account credentials to the client application based on user information. The application uses this service account to upload images to Cloud Storage.
Correct Answer:
B. Change the application to create signed URLs for Cloud Storage. Transfer these signed URLs to the client application to upload images to Cloud Storage.
Explanation

Using signed URLs for Cloud Storage is the most effective solution. The application backend generates a secure, time-limited URL that grants the client temporary permission to upload an object directly to a Cloud Storage bucket. This approach offloads the heavy lifting of the file transfer from your application servers to Google's highly scalable infrastructure. This significantly reduces the load on your backend, improves performance for the user, and minimizes your operational overhead because Cloud Storage is a fully managed service requiring no server maintenance.

Why Incorrect

A. Storing large binary files (up to 1 GB) in a database is highly inefficient. It bloats the database, degrades query performance, and complicates backup and scaling operations.
C. This traditional Infrastructure-as-a-Service (IaaS) approach requires you to provision, manage, scale, and patch web servers, which is the exact opposite of minimizing infrastructure operations overhead.
D. Transferring long-lived service account credentials to a client application is a severe security vulnerability. Furthermore, creating and managing a separate bucket and service account for each user is not scalable and creates immense operational complexity.

References

1. Google Cloud Documentation, Cloud Storage - Signed URLs: "Signed URLs give time-limited resource access to anyone in possession of the URL, regardless of whether they have a Google account... You give a user the signed URL, and the user has access to the resource for the duration of time you specified." This document outlines the exact pattern described in the correct answer.

2. Google Cloud Documentation, Cloud Storage - Uploading objects: Under the section "Direct uploads from the browser using signed URLs (POST)," the documentation states, "This method is useful if you want to let your users upload files to your Cloud Storage buckets. In a traditional model, users would upload files to your app server, which would in turn upload the files to Cloud Storage. With signed URLs, however, your users can send the data directly to Cloud Storage." This directly supports offloading the upload process to minimize server load and operational overhead.

3. Google Cloud Documentation, IAM - Best practices for working with service accounts: Under the "Do not embed service account keys in your code" section, it warns: "Embedding service account keys in your code is a significant security risk... If your code is public, for example in a public GitHub repository, anyone can use your key to access your Google Cloud resources." This directly refutes the approach in option D.

Scroll to Top