PROFESSIONAL-CLOUD-DEVELOPER · Question #120
You want to create fully baked or golden Compute Engine images for your application. You need to bootstrap your application to connect to the appropriate database according to the environment the appl
The correct answer is D. When creating the Compute Engine instance, create a metadata item with a key of "DATABASE". Instance metadata is the Google-recommended mechanism for passing environment-specific configuration to Compute Engine instances at runtime without baking environment-specific values into the image. By setting a metadata key (e.g., 'DATABASE') with the appropriate value when crea
Question
You want to create fully baked or golden Compute Engine images for your application. You need to bootstrap your application to connect to the appropriate database according to the environment the application is running on (test, staging, production). What should you do?
Options
- AEmbed the appropriate database connection string in the image. Create a different image for
- BWhen creating the Compute Engine instance, add a tag with the name of the database to be
- CWhen creating the Compute Engine instance, create a metadata item with a key of "DATABASE"
- DWhen creating the Compute Engine instance, create a metadata item with a key of "DATABASE"
How the community answered
(31 responses)- A3% (1)
- B10% (3)
- C6% (2)
- D81% (25)
Explanation
Instance metadata is the Google-recommended mechanism for passing environment-specific configuration to Compute Engine instances at runtime without baking environment-specific values into the image. By setting a metadata key (e.g., 'DATABASE') with the appropriate value when creating the instance, the application can query the metadata server (http://metadata.google.internal) at startup to retrieve the correct database connection string. This keeps the golden image truly environment-agnostic. Embedding environment-specific values directly in the image (Option A) defeats the purpose of a reusable golden image and requires a separate image per environment. Instance tags (Option B) are used for networking and firewall rules, not configuration data.
Topics
Community Discussion
No community discussion yet for this question.