Topic 1 Question 147
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?
Define your service endpoint information as metadata that is retrieved at runtime and used to connect to the desired service.
Define your service endpoint information as label data that is retrieved at runtime and used to connect to the desired service.
Define your service endpoint information to be retrieved from an environment variable at runtime and used to connect to the desired service.
Define your service to use a fixed hostname and port to connect to the desired service. Replace the service at the endpoint with your new version.
ユーザの投票
コメント(5)
- 👍 2TNT872022/12/25
- 正解だと思う選択肢: B
An example of how you can retrieve the endpoint information from a label in Python:
import google.auth from google.cloud import compute
Authenticate and create a client for the Compute Engine API
credentials, project = google.auth.default() compute_client = compute.Client(credentials=credentials, project=project)
Get the instance based on the instance name
instance_name = "example-instance" instance = compute_client.instance(instance_name)
Get the endpoint information from the instance's labels
endpoint = instance.labels.get("endpoint")
👍 2mrvergara2023/02/07 - 正解だと思う選択肢: A
Correct Answer: A. best practice B - There's no label data C - harder to commit env? D - not sure about this
👍 1gardislan182022/12/03
シャッフルモード