Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
gcloud beta compute --project=<project_id> instance-templates create hello-world-envoy \
--machine-type=e2-medium \
--subnet=projects/<project_id>/regions/asia-southeast2/subnetworks/<subnet> \
--network-tier=PREMIUM \
--metadata=startup-script=\#\!\ /bin/bash$'\n'apt-get\ update$'\n'apt-get\ install\ apache2\ -y$'\n'a2ensite\ default-ssl$'\n'a2enmod\ ssl$'\n'vm_hostname=\"\$\(curl\ -H\ \"Metadata-Flavor:Google\"\ \\$'\n'http://169.254.169.254/computeMetadata/v1/instance/name\)\"$'\n'echo\ \"Page\ served\ from:\ \$vm_hostname\"\ \|\ \\$'\n'tee\ /var/www/html/index.html \
--maintenance-policy=MIGRATE \
--service-account=<service_account> \
--scopes=https://www.googleapis.com/auth/cloud-platform \
--region=asia-southeast2 \
--tags=http-server,https-server \
--image=debian-9-stretch-v20210817 \
--image-project=debian-cloud \
--boot-disk-size=10GB \
--boot-disk-type=pd-balanced \
--boot-disk-device-name=hello-world-envoy \
--reservation-affinity=any \
--service-proxy=enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment