Google Cloud Professional Cloud Developer — Question 113
You are developing an application that will allow clients to download a file from your website for a specific period of time. How should you design the application to complete this task while following Google-recommended best practices?
Answer options
- A. Configure the application to send the file to the client as an email attachment.
- B. Generate and assign a Cloud Storage-signed URL for the file. Make the URL available for the client to download.
- C. Create a temporary Cloud Storage bucket with time expiration specified, and give download permissions to the bucket. Copy the file, and send it to the client.
- D. Generate the HTTP cookies with time expiration specified. If the time is valid, copy the file from the Cloud Storage bucket, and make the file available for the client to download.
Correct answer: B
Explanation
The correct answer is B because generating a Cloud Storage-signed URL provides a secure and time-limited access point for clients to download files directly from storage. Option A is inappropriate as email attachments do not adhere to the best practices for temporary file access. Option C complicates the process by involving a temporary bucket, which is unnecessary for this task. Option D relies on cookies, which is not as efficient or secure as using signed URLs for file downloads.