Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Google Cloud Certified Professional Cloud Developer · Google Cloud
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The best answer is D. During each instance launch, configure an instance custom-metadata key named ‘environment’ whose value is the environment the instance serves. Use your deployment tool to query the instance metadata, and configure the application based on the ‘environment’ value. Here's why: Simplicity and Efficiency: This approach is the most straightforward and efficient. It leverages existing Compute Engine features (custom metadata) and avoids the need for additional scripts or deployment tools. Centralized Configuration: Custom metadata is associated with the instance itself, making it a centralized and reliable source of environment information. Flexibility: Your deployment tool can easily query the instance metadata during deployment, allowing you to dynamically configure the application based on the environment.
Let's analyze why the other options are less ideal: A. Startup script using gcloud command: While startup scripts can be used, they require additional code and complexity. They also rely on the project name, which might not be the most reliable way to determine the environment. B. Metadata key ‘environment’ in each project: This approach requires configuring the metadata key in each project, which can be tedious and error-prone. It also doesn't provide a centralized way to manage environment information. C. Deployment tool on an instance in each project: This approach introduces additional complexity and overhead. It requires deploying and managing a separate deployment tool in each project, which can be challenging to maintain.