nerdexam
Google

PROFESSIONAL-CLOUD-DEVELOPER · Question #103

You are developing an application that will be launched on Compute Engine instances into multiple distinct projects, each corresponding to the environments in your software development process (develo

The correct answer is B. In each project, configure a metadata key "environment" whose value is the environment it. Configuring a project-level metadata key named 'environment' in each GCP project is the correct approach because it minimizes steps. Compute Engine instances can read project metadata at runtime via the metadata server (http://metadata.google.internal), so each instance can autom

Developing and Deploying Applications

Question

You are developing an application that will be launched on Compute Engine instances into multiple distinct projects, each corresponding to the environments in your software development process (development, QA, staging, and production). The instances in each project have the same application code but a different configuration. During deployment, each instance should receive the application's configuration based on the environment it serves. You want to minimize the number of steps to configure this flow. What should you do?

Options

  • AWhen creating your instances, configure a startup script using the gcloud command to determine
  • BIn each project, configure a metadata key "environment" whose value is the environment it
  • CDeploy your chosen deployment tool on an instance in each project. Use a deployment job to
  • DDuring each instance launch, configure an instance custom-metadata key named "environment"

How the community answered

(52 responses)
  • A
    17% (9)
  • B
    71% (37)
  • C
    8% (4)
  • D
    4% (2)

Explanation

Configuring a project-level metadata key named 'environment' in each GCP project is the correct approach because it minimizes steps. Compute Engine instances can read project metadata at runtime via the metadata server (http://metadata.google.internal), so each instance can automatically determine which environment it belongs to without any instance-specific configuration. This is a clean, built-in GCP mechanism requiring only one metadata entry per project. Option A uses startup scripts with gcloud commands, which adds complexity. Option C requires deploying a separate deployment tool instance in each project, which is more infrastructure to manage. Option D configures the metadata at the instance level, which means every individual instance must be configured separately - far more steps than setting it once at the project level.

Topics

#Compute Engine#Metadata#Application Configuration#Multi-environment Deployment

Community Discussion

No community discussion yet for this question.

Full PROFESSIONAL-CLOUD-DEVELOPER Practice