ASSOCIATE-CLOUD-ENGINEER · Question #253
ASSOCIATE-CLOUD-ENGINEER Question #253: Real Exam Question with Answer & Explanation
The correct answer is C: curl metadata.google.internal/computeMetadata/v1/. To fetch metadata from a Google Cloud VM instance, applications should use the specific internal domain metadata.google.internal and the /computeMetadata/v1/ path with the appropriate Metadata-Flavor header.
Question
You want your application hosted on a VM to fetch metadata of that instance. Which command will help you to fetch it?
Options
- Acurl metadata.google.internal/compute-metadata/v1/
- Bcurl <instance-private-ip>/metadata/v1/
- Ccurl metadata.google.internal/computeMetadata/v1/
- Dcurl internal.googleapi.com/computeMetadata/v1/
Explanation
To fetch metadata from a Google Cloud VM instance, applications should use the specific internal domain metadata.google.internal and the /computeMetadata/v1/ path with the appropriate Metadata-Flavor header.
Common mistakes.
- A. The path
compute-metadatawith a hyphen is incorrect; the correct path uses camel casecomputeMetadata. - B. Directly querying the instance's private IP for metadata is not the standard or recommended method; the special internal DNS name
metadata.google.internalis used. - D. The domain
internal.googleapi.comis used for other internal Google APIs, not specifically for fetching instance metadata from a VM itself.
Concept tested. Accessing Google Cloud instance metadata
Reference. https://cloud.google.com/compute/docs/storing-retrieving-metadata#default
Community Discussion
No community discussion yet for this question.