Professional Cloud Architect Exam QuestionsBrowse all questions from this exam

Professional Cloud Architect Exam - Question 181


You have a Compute Engine managed instance group that adds and removes Compute Engine instances from the group in response to the load on your application. The instances have a shutdown script that removes REDIS database entries associated with the instance. You see that many database entries have not been removed, and you suspect that the shutdown script is the problem. You need to ensure that the commands in the shutdown script are run reliably every time an instance is shut down. You create a Cloud Function to remove the database entries. What should you do next?

Show Answer
Correct Answer: AC

To ensure that the commands in the shutdown script are run reliably every time an instance is shut down, you should set up a Cloud Monitoring sink that triggers the Cloud Function after an instance removal log message arrives in Cloud Logging. Compute Engine executes shutdown scripts only on a best-effort basis, and there is no guarantee that the shutdown script will complete. By using Cloud Logging to detect when an instance is removed and triggering the Cloud Function through a Cloud Monitoring sink, you create a more reliable and consistent mechanism for executing the necessary tasks, such as removing database entries when an instance is shut down.

Discussion

17 comments
Sign in to comment
TeslaOption: C
Oct 28, 2022

Actually C is correct but Wrong also in a way .. Sink cannot trigger a cloud function directly. It need Pub/Sub which then will trigger Cloud Function.

omermahgoubOption: C
Dec 26, 2022

The correct answer is C: Set up a Cloud Monitoring sink that triggers the Cloud Function after an instance removal log message arrives in Cloud Logging. In this scenario, you want to ensure that the commands in the shutdown script are run reliably every time an instance is shut down. One way to do this is by setting up a Cloud Monitoring sink that triggers a Cloud Function after an instance removal log message arrives in Cloud Logging. This will allow you to use the Cloud Function to perform the necessary tasks (such as removing database entries) when an instance is shut down, and it will ensure that these tasks are performed reliably and consistently. Option A: Modifying the shutdown script to wait for 30 seconds before triggering the Cloud Function is not a reliable solution, as it relies on the shutdown script being able to run for at least 30 seconds before the instance is shut down.

omermahgoub
Dec 26, 2022

Option B: Modifying the shutdown script to restart if it has not completed in 30 seconds is also not a reliable solution, as it may not be feasible to restart the script if the instance has already been shut down. Option D: Modifying the shutdown script to wait for 30 seconds and then publish a message to a Pub/Sub queue is not a reliable solution, as it relies on the shutdown script being able to run for at least 30 seconds before the instance is shut down, and it also requires additional infrastructure (a Pub/Sub queue) to be set up and maintained.

zellckOption: C
Sep 14, 2022

C is the answer as shutdown script is run based on best effort and not a reliable method. https://cloud.google.com/compute/docs/shutdownscript#limitations Compute Engine executes shutdown scripts only on a best-effort basis. In rare cases, Compute Engine cannot guarantee that the shutdown script will complete.

kuboraamOption: C
Sep 7, 2022

C would be the cleanest solution. Although at this time, Cloud Monitoring sink cannot trigger a cloud function directly, it can be done via Pub/Sub. Still better than solution D.

charlie_leeOption: D
Sep 23, 2022

use pub/sub trigger cloud function

AzureDP900Option: C
Oct 15, 2022

C is right

meguminOption: C
Nov 21, 2022

C is ok

surajkrishnamurthyOption: C
Dec 16, 2022

C Is the Correct Answer

samirzubairOption: C
Dec 30, 2022

Correct Ans is C

SephethusOption: C
Jun 21, 2024

You cannot trigger a Cloud Function directly from a Cloud Monitoring sink. Instead, you can set up a Cloud Monitoring alert that sends notifications to a Pub/Sub topic, and then trigger the Cloud Function from that Pub/Sub topic.

rorzOption: C
Sep 5, 2022

Set up a Cloud Monitoring sink that triggers the Cloud Function after an instance removal log message arrives in Cloud Logging.

[Removed]Option: C
Sep 5, 2022

C looks not a professional way, but can make sure the work being done.

ramzez4815Option: C
Sep 6, 2022

C is the correct answer

Mahmoud_EOption: C
Oct 20, 2022

c is correct

Mahmoud_EOption: C
Oct 23, 2022

C is the right answer

EryOption: C
Feb 2, 2023

cCorrect Ans is C

bruh_1Option: D
Sep 20, 2023

Option C is not an efficient way as it causes delay and complexity. on top of that, you wont be able to trigger a cloud function. Correct answer is option D.