Your Cloud Run service must display its project ID and region securely and with maximum performance. How should the service obtain that metadata?
Choose an answer
Tap an option to check your answer.
Correct answer: Use HTTP requests to query the metadata server endpoint with the Metadata-Flavor: Google header..
Why this is the answer
The metadata server endpoint provides instance metadata, including project ID and region, to your Cloud Run service via HTTP requests. This method is secure because the metadata server is only accessible from within the instance, and it's performant as it avoids external API calls or manual configuration. The Metadata-Flavor: Google header is essential for authenticating the request to the metadata server. Manually adding environment variables is less dynamic and scalable. Writing to the in-memory filesystem is not a standard or secure way to retrieve dynamic project metadata. The Cloud Asset Inventory API is for auditing and inventory, not for real-time instance metadata retrieval, and would introduce unnecessary latency and complexity.
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