Reputation: 1401
I know how to do it when I create an instance:
gcloud compute instances create ${INSTANCE_NAME} \
--machine-type=n1-standard-8 \
--scopes=https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email \
--min-cpu-platform="Intel Skylake" \
${IMAGE} \
--image-project=deeplearning-platform-release \
--boot-disk-size=100GB \
--boot-disk-type=pd-ssd \
--accelerator=type=nvidia-tesla-p100,count=1 \
--boot-disk-device-name=${INSTANCE_NAME} \
--maintenance-policy=TERMINATE --restart-on-failure \
--metadata="proxy-user-mail=${GCP_LOGIN_NAME},install-nvidia-driver=True,startup-script=${STARTUP_SCRIPT}"
but what if I already have an instance, how do I update/create the startup script?
Upvotes: 0
Views: 853
Reputation: 75970
To add or update the metadata, you can use the endpoint "add-metadata" like this
gcloud compute instances add-metadata ${INSTANCE_NAME} \
--metadata startup-script=${NEW_STARTUP_SCRIPT}
The other metadatas are kept.
Upvotes: 2