Complete the code to add a startup script to a Compute Engine instance metadata.
gcloud compute instances add-metadata my-instance --metadata startup-script=[1]The startup script must be a string with a valid shell script. Option C is a common example.
Complete the code to create a VM instance with a startup script that updates packages.
gcloud compute instances create my-vm --metadata startup-script=[1]On Debian/Ubuntu systems, the startup script to update packages uses apt-get update.
Fix the error in the startup script metadata to correctly run a script that installs nginx.
gcloud compute instances add-metadata web-server --metadata startup-script=[1]The correct apt-get install command places the -y flag before the package name to auto-confirm installation.
Fill both blanks to write a startup script that creates a file and writes text into it.
#!/bin/bash echo [1] > /tmp/startup.txt chmod [2] /tmp/startup.txt
The script writes a message to a file and sets permissions to 644 for read/write by owner and read by others.
Fill all three blanks to create a startup script that updates packages, installs nginx, and starts the service.
#!/bin/bash sudo [1] update -y sudo [2] install -y nginx sudo systemctl [3] nginx
The script uses apt-get to update and install nginx, then starts the nginx service.