Configuring HTTP(S) load balancing

Let's take an example where we create two VMs in different regions with the same tag, and test them for HTTP(S) load balancing:

  1. Use the following command to create a VM and allow HTTP(S) traffic to it. Here, we are installing Debian on the VM and running commands such as updating it, installing Apache on it, and hosting a simple web page on it. You can name these instances sequentially for convenience, for example, www-1, www-2, and so on:
gcloud compute instances create <<<first-instance-name>>>  \    --image-family debian-8 \    --image-project debian-cloud \    --zone us-central1-b \    --tags https-tag \    --metadata startup-script="#! /bin/bash /sudo apt-get update /sudo apt-get install apache2 -y /sudo a2ensite ...

Get Google Cloud Platform for Architects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.