How do I add a startup script to an existing VM from the developer console?

前端 未结 3 1841
旧时难觅i
旧时难觅i 2021-02-12 12:50

I have an existing, already configured VM on Google Cloud Platform. It was created without a startup script, but I\'d like to add one now.

How do I add it from the conso

3条回答
  •  别跟我提以往
    2021-02-12 13:13

    The above answer is correct as per the question.

    But what I was looking for to add multiple .sh scripts in startup metadata of GCP VM via gcloud command.

    Below works for me (maybe it will help someone)

    To add multiple key-value pairs at once, separate them with commas:
    
    $ gcloud compute instances add-metadata test-instance \
          --metadata=important-data="2 plus 2 equals\
       4",unimportant-data=zero
    

    Docs link- https://cloud.google.com/sdk/gcloud/reference/compute/instances/add-metadata

提交回复
热议问题