In this video we are going to implement a system for automatically restarting a compute engine (GCE) instance when an alert gets triggered. Google Cloud doesn't have this feature built in and I will discuss why I think this is. As a workaround we are going to write a Cloud Function with a Pub/Sub trigger and then the alert will publish on this Pub/Sub topic to start the process. We are going to write the Cloud Function in Python using the Compute Engine API via the Google API Python Client.
Source code:
https://vladsave.com/?p=256
Chapters:
00:00 Introduction
00:32 Why Google Cloud doesn't have auto restarts
01:77 Planning
02:28 The API and Python library we are going to use
03:05 Check the status of a VM
09:52 Start, stop VM
17:47 Deploy the code as Cloud Function, wire the alert to trigger the function
Watch video Automatically restart Compute Engine (GCE) instance when an alert gets triggered online without registration, duration hours minute second in high quality. This video was added by user Vladsave Coding 09 June 2022, don't forget to share it with your friends and acquaintances, it has been viewed on our site 969 once and liked it 15 people.