I am creating an instance like this:
gcloud compute instances create $(INSTANCE) \
--machine-type a2-highgpu-1g \
--provisioning-model=SPOT \
--image-family $(IMAGE) \
--image-project deeplearning-platform-release \
--metadata install-nvidia-driver=True \
--metadata-from-file startup-script=gce/bootstrap.sh,code=/tmp/code.tar
But it seems that the startup script never gets run because when I do:
gcloud compute ssh $(INSTANCE) \
--zone $(ZONE) \
--project $(COMPUTE_PROJECT) \
--command "sudo journalctl -u google-startup-scripts.service"
the output is
-- Logs begin at Fri 2023-06-16 18:21:34 UTC, end at Mon 2023-07-24 18:28:29 UTC. --
-- No entries --
What am I doing wrong with the startup script?
You can try to debug it by accessing the VM instance then manually run the script. Normally the script is located in this directory /var/lib/google. Here is a documentation regarding start-up scripts that can be helpful for your case.[1]
[1] https://cloud.google.com/compute/docs/instances/startup-scripts