QuestionQ8

VerifiedEnsuring solution and operations excellence

You have a Compute Engine managed instance group that adds and removes Compute Engine instances in response to your application's load. The instances use a shutdown script to remove REDIS database entries associated with each instance. You notice that many database entries were not removed and suspect the shutdown script is the cause.

You must ensure the commands in the shutdown script execute reliably whenever an instance is shut down. You create a Cloud Run function to remove the database entries. What should you do next?

Explanation

Compute Engine executes shutdown scripts on a best-effort basis, and a script can be forcibly stopped before it completes. Triggering the cleanup from an instance-removal log event moves the work outside the terminating VM, so the Cloud Run function can remove the associated Redis entries independently of shutdown-script completion. Cloud Logging sinks can route matching log entries to a destination for event-driven processing.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!