ability to run startup script only once
I'd like to use startup script to initially bootstrap my VM. After that I will manage it using Puppet/Chef/Ansible.
It seems counter productive to run the script every time the instance reboots. If the configuration needs to change, Puppet/Chef/Ansible will take care of it.
If nothing works, VM gets deleted and another one comes up.
Thanks, we’ll look into this. In the meantime, it seems like you could accomplish something like this by having the first successful run of your script create a “touch file” (“touch ~/.ran-startup-script”) and then have your script check for that file as the first thing it does, and if it exists on the disk, then just exit.
What is the status for this request? ETA? ~2 years have passed
In your startup script you can have it removed the startup-script metadata at the end from the host instance
Not sure if this helps, but you can do that via Google Deployment Manager https://cloud.google.com/deployment-manager/docs/step-by-step-guide/setting-metadata-and-startup-scripts - kind of similar to AWS UserData scripting via CloudFormation.