Read this post to understand the different ways to pass in a startup script to compute engine (using terraform)

To view metadata attributed set on the instance (e.g. foo=bar)

View the values of compute instance metadata
user@myinstance:~$ curl http://metadata/computeMetadata/v1/instance/attributes/foo -H "Metadata-Flavor: Google"
bar

Viewing startup script logs
Startup script output is written to the following log files:

  • CentOS and RHEL: /var/log/messages
  • Debian: /var/log/daemon.log
  • Ubuntu: /var/log/syslog
  • SLES: /var/log/messages

You can also use the journalctl command to view startup script output.

  • sudo journalctl -u google-startup-scripts.service

Next Steps?

Need help with your GCP efforts? Start the conversation today.