You’ve been tasked with configuring number of to be created GCE instances . Answer to which of the following should you do was below .
"Write one startup script for the fleet and pass additional metadata to each instance. "
what is passing additional metadata to each instance ? how come metadata help startup script ? when 5 instances need 5 different startup scripts , how come we can have single script for all 5 and then adding addtional metadata would help ?
From within a GCE instance, you can always query its metadata by sending HTTP request to
http://metadata.google.internal or using pre-installed
gcloud command, then passing the result to something like variable environments which startup script will interpret and process accordingly, or feeding those metadata as arguments for startup script. This is however feasible only if you have a uniform requirement of steps that you want those instances to perform (i.e. they have somewhat (almost) the same startup script, only parameters are different).
In case each individual instance need to perform a different set of actions, then the solution won’t work.
IMO, the question was asking about a specific case, but perhaps its wording is not clear enough and make learners confusing.