 <p>So my solution is following:</p> <ol> <li>I created an instance.</li> <li>Install the required services on that instance.</li> <li>Created the image from the disk using the steps mentioned on this <a href="https://cloud.google.com/compute/docs/images#create_an_image_from_a_root_persistent_disk" rel="nofollow">link</a>.</li> <li>With that Image created a new template.</li> </ol> <p>The <a href="https://cloud.google.com/compute/docs/startupscript" rel="nofollow">startup scripts</a> will run on instance boots up or restarts. So the only way I found to run it once is the same which you have tired i.e deleting them from metadata. In my setup when using startup scripts I don't reboot the instances I rather delete them and create a new ones if required.</p>