1 Answers
A startup script is simply a script with commands to be executed when the OS of a GCE instance finishes its boot procedure. Content of this startup script of course must be "understandable" and "executable" by the OS inside that GCE instance.
That said, you must manually define the content of startup script per your own need.
There are basically 3 ways of loading a startup script:
Directly paste the content into startup script field when you create GCE instance with Console (web interface)
Load the content from a locally-stored file, usually used when you create GCE instance with Cloud SDK (the
gcloud
command).Load the content from an object stored in a GCS bucket. This is the only way if you want to use a startup script whose size is more than 256 KB.
I think we need to create and then give that script at the time of instance creation. Then it will start executing once that particular instance started.