Watch how to set up Startup and Shutdown scripts to perform automated tasks on your Compute Engine Instance in Google Cloud Platform. I will show that on easy-to-understand demo - by creating a new Linux (Debian) VM Instance, that will automatically install Apache2 HTTP Server and adjust the homepage to my needs. Additionally, I will also configure a simple shutdown script, that creates a custom log file entry with uptime and timestamp message. Of course those are just simple examples, and both shutdown and startup scripts might be much more complicated. You can also specify them in the file, and point the metadata to the file, instead of writing down the script in the text-field.
If you want to read more about Startup Scripts: https://cloud.google.com/compute/docs...
If you want to read more about Shutdown Scripts: https://cloud.google.com/compute/docs...
The above docs also specify how to verify the results of the job, and explain in more details how to set those scripts in other languages, or for other OS systems, for example Windows family. I wanted to keep my video rather short, that's why I did not include it in the tutorial.
Later on I explain, using the example, why Startup script might not be always the best universal solution, and briefly show how you can take advantage of Custom Image functionality - why it's sometimes better to consider this, as an alternative.
You can read more about custom images in the official documentation page here: https://cloud.google.com/compute/docs...
I hope you enjoyed the video, and if you have any questions or comments, feel free to contact me or leave a comment below!