You can add the contents of a startup script directly to a VM when you create the VM,
You can also pass a Linux startup script directly to an existing VM:
In your Cloud Console go to VM Instance page and click on the instance you want to pass the startup script
- Click Edit
- Under Automation specify the following:
#! /bin/bash
shutdown -P +60
- P instructs the system to shut down and then power down.
The time argument specifies when to perform the shutdown operation.
The time can be formatted in different ways.
Firstly it can be an absolute time in the format hh:mm where hh is the hour and mm is the minute of the hour.
Secondly it can be of the format +m where m is the number of minutes to wait.
Also, the word now is the same as specifying +0; it shuts the system down immediately.