Match each Google Cloud service local development requirement with the appropriate emulator configuration command or environment variable required to bind client SDKs to local testing environments.
- Configuring local client libraries to direct event message publishing and subscription calls to a locally executing Cloud Pub/Sub emulator process.Execute `gcloud beta emulators pubsub start --host-port=localhost:8085` and set `export PUBSUB_EMULATOR_HOST=localhost:8085`.
- Configuring local application code and schema migration tooling to target a local Cloud Spanner emulator instance for SQL DDL and transactional DML execution.Execute `gcloud emulators spanner start` and set `export SPANNER_EMULATOR_HOST=localhost:9010` before creating instances and databases.
- Executing an ephemeral Datastore mode local emulator instance that keeps state entirely in memory without writing data files to disk during automated unit test runs.Execute `gcloud beta emulators datastore start --no-store-on-disk` and set `export DATASTORE_EMULATOR_HOST=localhost:8081`.
- Initializing a Cloud Bigtable emulator service on a developer workstation and configuring the application client SDK to bypass production Cloud IAM credentials.Execute `gcloud beta emulators bigtable start` and set `export BIGTABLE_EMULATOR_HOST=localhost:8086` in the execution context.
Answer
Each Google Cloud service emulator requires specific startup flags via gcloud CLI and corresponding environment variables (PUBSUB_EMULATOR_HOST, SPANNER_EMULATOR_HOST, DATASTORE_EMULATOR_HOST, BIGTABLE_EMULATOR_HOST) to redirect client library traffic locally without real cloud credentials.
Google Cloud client SDKs automatically detect emulator environment variables (e.g., `PUBSUB_EMULATOR_HOST`, `SPANNER_EMULATOR_HOST`, `DATASTORE_EMULATOR_HOST`, `BIGTABLE_EMULATOR_HOST`). When set, client calls are automatically redirected to the specified localhost ports without requiring production service account credentials or project authorization.
Step-by-Step Solution
Key Concept
Local GCP Service Emulators and Environment Configuration