Prepare and test your skills
Prepare and test your skills
Free sample question, answered and explained below. The Professional Cloud Architect practice bank has 2,335 more like it. Try 10 free: instant score, no account.
A development team is building a microservice that publishes messages to Google Cloud Pub/Sub. To reduce cloud consumption costs and ensure functional testing can occur offline on local workstations, developers need to test the application locally without modifying the production application code or changing how the Google Cloud client libraries are initialized.
Which sequence of actions should the team perform to install, start, and redirect client traffic to a local Pub/Sub emulator?
gcloud config set api_endpoint_overrides/pubsub to point to localhost:8085 and grant the roles/pubsub.admin IAM role to the Compute Engine default service account.The gcloud config set api_endpoint_overrides/ property modifies the target endpoint used by the gcloud CLI tool itself when executing administrative CLI commands, rather than configuring running application client libraries.
gcloud components.gcloud configuration files; they rely on specific environment variables like PUBSUB_EMULATOR_HOST.gcloud config only alter requests issued directly through the gcloud command-line tool.localhost:8085 will fail with connection refused errors.The goal were to point administrative gcloud pubsub CLI commands to a custom private API gateway or proxy endpoint.
This approach builds a full virtual machine infrastructure in Compute Engine managed instance groups behind an Application Load Balancer, using startup scripts to configure an HTTP server that simulates responses.
gcloud beta emulators) and requires custom API mock maintenance.The organization needed to host a high-throughput staging environment for large-scale performance and load testing across a hybrid multi-tier application architecture.
gcloud components install pubsub-emulator, start it with gcloud beta emulators pubsub start, and set the PUBSUB_EMULATOR_HOST environment variable using $(gcloud beta emulators pubsub env-init).env-init Solution IsThe Google Cloud Pub/Sub emulator is a local, in-memory implementation of the Cloud Pub/Sub service provided via the Google Cloud CLI (gcloud). It provides local emulation of the Cloud Pub/Sub service APIs, allowing developers to test publishing and subscription workflows locally and within continuous integration (CI) pipelines without generating cloud usage costs or requiring internet access.
gcloud components install pubsub-emulator.gcloud beta emulators pubsub start starts the emulator process on a local socket (by default localhost:8085).$(gcloud beta emulators pubsub env-init) evaluates and exports the PUBSUB_EMULATOR_HOST variable (e.g., PUBSUB_EMULATOR_HOST=localhost:8085), which instructs client libraries to redirect all calls to the local emulator without requiring any changes to the source code or client initialization logic.
PUBSUB_EMULATOR_HOST environment variable and switch from production endpoints to the local mock instance.env-init command automatically handles host and port configuration for shell sessions.This approach aligns with Google Cloud development best practices for local emulation by leveraging the built-in gcloud component manager and native client library hooks, providing functional equivalence without requiring custom endpoint routing logic in the application code.
GOOGLE_APPLICATION_CREDENTIALS on the workstation.This approach attempts to deploy a containerized mockup service onto Cloud Run in a remote Google Cloud project and sets the standard service account key environment variable (GOOGLE_APPLICATION_CREDENTIALS) on the developer's local machine for authentication.
GOOGLE_APPLICATION_CREDENTIALS only supplies authentication credentials; it does not redirect standard Google Cloud client libraries away from production endpoints to a local emulation target.GOOGLE_APPLICATION_CREDENTIALS handles authorization tokens for Google Cloud APIs, not host endpoint redirection.The requirement were to run a shared, cloud-hosted test stub in a centralized development VPC accessible by multiple remote developers rather than local workstation emulation.
Answer them yourself and get your score the moment you finish. No account needed.
Full access includes
Keep the momentum going with these hand-picked practice scenarios
Last updated