I would like to execute the shutdown script in case GCP compute instance is deleted by any means. I dont want to execute it in case instance is stopped.
Is there any way to achieve this please?
I am new to GCP and really dont have any clue if there is anything which can help me to achieve this.
Thanks in advance.
Sanjiv
Yes, there is an implementation for startup scripts and one for shutdown scripts for instances that run compatible images.
Bot types of scripts can be entered in the instance metadata directly through the GUI or the cloud shell or, in a more tidy way, you can upload the script file to one of your buckets and provide the url with the key "startup-script-url"