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)
Asked
Active
Viewed 606 times
1 Answers
0
This is the link you are looking for: https://cloud.google.com/compute/docs/instances/startup-scripts
Via the Console:
For Boot disk, select Change, and select a Linux operating system.
Expand the Networking, disks, security, management, sole tenancy section, and do the following:
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
- 958
- 3
- 12
- 24