Professional Cloud Developer Exam QuestionsBrowse all questions from this exam

Professional Cloud Developer Exam - Question 86


You are developing an application that will be launched on Compute Engine instances into multiple distinct projects, each corresponding to the environments in your software development process (development, QA, staging, and production). The instances in each project have the same application code but a different configuration. During deployment, each instance should receive the application's configuration based on the environment it serves. You want to minimize the number of steps to configure this flow. What should you do?

Show Answer
Correct Answer: BD

The most efficient approach is to configure a metadata key named 'environment' in each project, with a value corresponding to the environment it serves (e.g., development, QA, staging, or production). This allows the deployment tool to query the instance metadata and configure the application based on the 'environment' value. This setup minimizes the number of steps required, as the metadata key only needs to be set once per project, rather than for each instance, and simplifies the configuration flow.

Discussion

12 comments
Sign in to comment
scaenruyOption: B
Jan 9, 2022

I vote B

GCPCloudArchitectUserOption: B
Feb 25, 2022

For Answer D : Question says minimize steps and adding metadata to each instance seems longer route ?

KillerGoogleOption: D
Feb 28, 2022

D, 'environment' is not in one of the default key https://cloud.google.com/compute/docs/metadata/default-metadata-values

jitu028Option: B
Apr 9, 2022

Answer should be B

nqthien041292Option: B
Apr 28, 2022

Vote B

tomato123Option: B
Aug 20, 2022

B is correct

omermahgoubOption: B
Jan 6, 2023

Option A, configuring a startup script using the gcloud command to determine the project name, is not a feasible solution because it requires additional steps to be taken during instance launch. Option C, deploying a deployment tool on an instance in each project and using a deployment job to retrieve the appropriate configuration file, is not a feasible solution because it requires additional steps to be taken during instance launch and involves the use of a separate deployment tool. Option D, configuring an instance custom-metadata key named "environment" during each instance launch, is not a feasible solution because it requires additional steps to be taken during instance launch.

omermahgoub
Jan 6, 2023

Answer is B You can configure a metadata key named "environment" in each project, with a value corresponding to the environment it serves (development, QA, staging, or production). Then, you can use your deployment tool to query the instance metadata and configure the application based on the "environment" value. This allows you to minimize the number of steps to configure the flow, as you only need to set the "environment" value in each project and use your deployment tool to query the metadata.

TNT87
Nov 15, 2022

https://cloud.google.com/compute/docs/metadata/querying-metadata

TNT87
Nov 15, 2022

https://cloud.google.com/compute/docs/metadata/setting-custom-metadata#set-custom

[Removed]
Nov 17, 2022

Did you take the exam?

zellckOption: B
Dec 22, 2022

B is the answer. https://cloud.google.com/compute/docs/metadata/setting-custom-metadata#set-custom

RajanOption: B
Sep 20, 2023

Option B is correct we usually put this details in Environment variable.

wanrltwOption: B
Nov 21, 2023

https://cloud.google.com/compute/docs/metadata/setting-custom-metadata#set-custom-project-wide-metadata

thewalkerOption: D
Jul 18, 2024

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.

thewalker
Jul 18, 2024

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.