Google Cloud Professional Cloud Developer — Question 101

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?

Answer options

Correct answer: B

Explanation

Option B is correct because it allows you to set a project-specific metadata key that directly associates each instance with its environment, facilitating straightforward access during deployment. Options A and D suggest using startup scripts or custom-metadata keys but do not provide as streamlined a solution as using the existing instance metadata with a clear key-value mapping. Option C, while functional, introduces unnecessary complexity by requiring additional deployment jobs and version control interactions, thus increasing the number of steps involved.