Deploying Serverless Apps with Workspace Authentication

PCD By islever Editorial Last updated

Deploying applications to Cloud Run. Consuming Google Cloud APIs.

Short answer

BD Containerize the application and deploy it as a Cloud Run service, then configure Identity Aware Proxy to grant access using Google Workspace identities.

Question

You are developing a scalable web application for internal users. Your organization uses Google Workspace. You need to set up authentication to the application for the users, and then deploy the application on Google Cloud. You plan to use cloud-native features, and you want to minimize infrastructure management effort. What should you do? (Choose two.)
  1. Create a Compute Engine VM, configure a web server, and deploy the application in a VPC.
  2. Containerize the application, and deploy it as a Cloud Run service. Correct Answer
  3. Configure Cloud SQL database with a table containing the users and password hashes. Add an authentication screen to ensure that only internal users can access the application.
  4. Configure Identity Aware Proxy, and grant the roles/iap.httpsResourceAccessor IAM role to the users that need to access the application. Correct Answer

Key Takeaways

Cloud Run provides serverless container execution with zero infrastructure management, while Identity Aware Proxy secures internal apps using Google Workspace identity without managing auth code. This combination meets the requirements for scalability and minimized operational overhead.

Expert Analysis

The scenario requires a serverless deployment that leverages existing Google Workspace identities, making the combination of Cloud Run for infrastructure and Identity Aware Proxy (IAP) for access control the only viable path. Option B provides the zero-infrastructure compute layer required by the constraint to minimize management effort, while Option D integrates directly with Google Workspace for authentication without requiring custom code or database maintenance. Options A and C introduce unnecessary operational overhead and security risks by reinventing identity management and managing virtual machines.

Cloud Run Eliminates Infrastructure Management Overhead

The requirement to "minimize infrastructure management effort" is the primary driver for selecting Cloud Run over Compute Engine. Cloud Run is a fully managed, serverless platform that executes containers in a secure, isolated environment without requiring the user to provision, patch, or scale underlying servers. When you containerize an application and deploy it to Cloud Run, Google Cloud handles all the operational aspects of the compute layer, including scaling from zero to thousands of requests based on traffic. This aligns perfectly with the goal of building scalable web applications with minimal operational burden. In contrast, deploying to a Compute Engine VM (Option A) requires the developer to manage the operating system, apply security patches, configure auto-scaling policies, and monitor instance health. While a VPC provides network isolation, it does not reduce the administrative load associated with maintaining the compute instances themselves. For internal applications where speed of deployment and ease of maintenance are prioritized, Cloud Run offers a superior abstraction layer that allows developers to focus entirely on the application logic rather than the underlying infrastructure. This serverless approach is a core tenet of cloud-native design, ensuring that the application can scale elastically without manual intervention or capacity planning.

IAP Leverages Google Workspace for Secure Access

Identity Aware Proxy (IAP) serves as the critical component for securing access to the application using existing Google Workspace credentials. IAP acts as a reverse proxy that intercepts incoming requests and verifies the identity of the user before allowing access to the backend service. By granting the roles/iap.httpsResourceAccessor IAM role to specific users or groups, administrators can restrict access to the Cloud Run service exclusively to authenticated Google Workspace members. This eliminates the need to build, test, and maintain a custom authentication system, which would otherwise require handling password storage, hashing algorithms, session management, and potential vulnerabilities like SQL injection or credential stuffing. Option D ensures that only authorized internal users can reach the application, satisfying the security requirement while integrating seamlessly with the organization's existing identity provider. This method is more secure and easier to manage than custom solutions because it offloads the complexity of identity verification to Google Cloud’s highly available and secure IAM infrastructure. It also supports multi-factor authentication if configured at the workspace level, adding an extra layer of security without any changes to the application code.

Custom Auth and VMs Introduce Unnecessary Risks and Costs

Option C proposes configuring a Cloud SQL database to store user passwords and hashes, coupled with a custom authentication screen. This approach is fundamentally flawed for this scenario because it duplicates functionality already provided by Google Workspace. Managing user credentials manually introduces significant security liabilities, including the risk of weak password policies, insecure hash storage, and the operational burden of password resets and account lockouts. Furthermore, it fails to meet the objective of minimizing infrastructure management because it adds a persistent database resource that must be monitored, backed up, and secured. Similarly, Option A suggests using Compute Engine, which violates the constraint to minimize management effort. While Compute Engine offers flexibility, it requires substantial DevOps overhead for patching, scaling, and monitoring. The combination of a VM and a custom auth database represents a legacy architecture pattern that contradicts the cloud-native principles of automation, scalability, and security-by-design inherent in the exam objectives.

Alternative Conditions Would Shift the Architecture

A different answer would be appropriate if the application required low-level OS access, persistent local storage beyond Cloud Storage buckets, or specific kernel-level configurations. For example, if the workload needed to run custom daemons or interact with hardware devices, Compute Engine (Option A) would become necessary despite the higher management cost. Alternatively, if the organization did not use Google Workspace and instead relied on a separate LDAP directory or custom identity provider, IAP might not be the optimal choice, and a custom OAuth2/OIDC implementation would be required. However, since the scenario explicitly states the use of Google Workspace and emphasizes minimal infrastructure management, these alternative conditions do not exist. The current constraints firmly point to the serverless, identity-integrated stack of Cloud Run and IAP as the correct architectural decision.

Practice All PCD Questions

Access 84 questions with complete answers and detailed explanations.

View Full PCD Practice Test →

← Back to PCD Study Guide