Google Cloud Professional Cloud Architect — Question 248

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?

Answer options

Correct answer: C

Explanation

The correct answer is C because setting up a Cloud Monitoring sink allows the Cloud Function to be triggered reliably based on the instance removal log, ensuring the database entries are removed after the instance is shut down. Options A and D introduce a delay or send a message without guaranteeing execution, while option B does not utilize the Cloud Function at all, making it less effective for reliable execution.