0

Good evening, I've been trying to modify my Instance Startup script in Google Compute Engine, nevertheless with a new version of GCE (probably Dec 2021 or Nov 2021) the display has changed. Moveover it seems like we can't use a "startup-script" metadata anymore and need to use the "startup script section" instead. But this section is nowhere to be found. At least to me. Does anyone have more info about it ? Am I missing something ? GCE screenshot (sorry it's french)

1 Answers1

0

This is the link you are looking for: https://cloud.google.com/compute/docs/instances/startup-scripts

Via the Console:

  1. For Boot disk, select Change, and select a Linux operating system.

  2. Expand the Networking, disks, security, management, sole tenancy section, and do the following:

  3. Expand the Management section. In the Automation section, add your startup script:

I always recommend using the gcloud CLI or a tool like Terraform if you are up for it

gcloud compute instances create VM_NAME \
  --image-project=debian-cloud \
  --image-family=debian-10 \
  --metadata=startup-script='#! /bin/bash
  apt update
  apt -y install apache2
  cat <<EOF > /var/www/html/index.html
  <html><body><p>Linux startup script added directly.</p></body></html>'

gcloud compute instances create VM_NAME \
  --image-project=debian-cloud \
  --image-family=debian-10 \
  --metadata-from-file=startup-script=FILE_PATH
KCD
  • 878
  • 3
  • 11
  • 23