You deploy identical application code across projects for dev/QA/staging/production; each project needs environment-specific configuration at startup with minimal steps. What should you do?
Choose an answer
Tap an option to check your answer.
Correct answer: In each project, configure a metadata key 'environment' whose value is the environment it serves. Use your deployment tool to query the instance metadata and configure the application based on the 'environment' value..
Why this is the answer
The correct answer leverages project-level metadata, which is ideal for environment-specific configurations that apply to all instances within a project. By setting a 'environment' metadata key at the project level, any instance launched in that project can easily query this metadata to determine its environment (dev, QA, staging, prod) and load the appropriate configuration. This approach is efficient and ensures consistency across all instances in a given project with minimal setup. The option of configuring a startup script using the gcloud command to determine the project name is less flexible, as it relies on parsing the project name, which might not always directly map to the environment. Deploying a deployment tool on an instance in each project to retrieve configuration from version control adds unnecessary complexity and overhead compared to using native metadata. Configuring an instance custom-metadata key for each instance is redundant when the environment is project-wide; it would require setting the same metadata for every instance, increasing management effort.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed