October 2019
Intermediate to advanced
520 pages
13h 5m
English
When populating the variables for a GCE deployment, we can also set a startup script if we wish. This is a script that will run when your instance boots up or restarts. Common examples would be to install specific software or ensure services are started. These scripts are specified through the same metadata server we previously mentioned and use the startup script metadata keys. Again, these scripts can be added via gcloud commands as well as at the console. Let's look at the example commands from the CLI. This is installing apache2 and populating the main page:
gcloud compute instances create cloudarchitect --tags http-server \--metadata startup-script='#! /bin/bash# Installs apache and a custom homepagesudo su -apt-get update ...
Read now
Unlock full access