PROFESSIONAL-CLOUD-DEVELOPER · Question #164
Your application is composed of a set of loosely coupled services orchestrated by code executed on Compute Engine. You want your application to easily bring up new Compute Engine instances that find a
The correct answer is A. Define your service endpoint information as metadata that is retrieved at runtime and used to. GCP instance and project metadata can be set and retrieved dynamically at runtime via the Metadata Server API. This makes it ideal for service discovery in loosely coupled architectures - you can store service endpoint information (URLs, versions, ports) as metadata and query it
Question
Your application is composed of a set of loosely coupled services orchestrated by code executed on Compute Engine. You want your application to easily bring up new Compute Engine instances that find and use a specific version of a service. How should this be configured?
Options
- ADefine your service endpoint information as metadata that is retrieved at runtime and used to
- BDefine your service endpoint information as label data that is retrieved at runtime and used to
- CDefine your service endpoint information to be retrieved from an environment variable at runtime
- DDefine your service to use a fixed hostname and port to connect to the desired service. Replace
How the community answered
(64 responses)- A78% (50)
- B8% (5)
- C3% (2)
- D11% (7)
Explanation
GCP instance and project metadata can be set and retrieved dynamically at runtime via the Metadata Server API. This makes it ideal for service discovery in loosely coupled architectures - you can store service endpoint information (URLs, versions, ports) as metadata and query it at startup or during execution without baking it into the image. Labels (B) are key-value pairs used for resource organization and filtering, not for runtime data retrieval. Environment variables (C) are set at deployment/launch time and cannot be updated dynamically without restarting the instance. Fixed hostnames/ports (D) create tight coupling and break the loose-coupling requirement.
Topics
Community Discussion
No community discussion yet for this question.