You can create and manage groups of virtual machine instances in GCP, instead of individually controlling each instance in your project.

The managed instance group is an instance template which is used to create a group of identical instances. You can automatically add or delete instances from a managed instance group based on the increase or decrease in load.

To create an instance template,

  • Navigate to Google Cloud > Compute Engine > VM instances from the GCP console. Click CREATE INSTANCE.

  • Specify the Name of the instance.

  • Select the region and zone details.

  • Select the machine type from the Machine Type drop-down menu to configure the machine. For instance, you can select e2-small (2 vCPU, 2 GB memory) option.

  • Deploy a container image to this VM instance by clicking DEPLOY CONTAINER button.

  • Select a boot disk. You can amend the values by clicking CHANGE button.

  • Under Identity and API access, select the Service account option from the drop-down menu. You can also select access scopes and firewall options.

    • If you are using a default Compute Engine service account, and if the project has Compute Engine default service account enabled, select that as the Service account. Also, select Set access for each API option and select Read Only permissions under Compute Engine drop-down menu.

    • If you are using a non-default service account, see Configuring Controller Service Account. Select Read Only permissions under Compute Engine drop-down menu.

  • Click Allow HTTP traffic check box in Firewall section to permit outside connections.

  • Enter networking details such as, network tags and hostname in Networking section.

  • Check IP forwarding box to enable it.

  • Select the Network interface card options from the drop-down menu. Select Increase total egress bandwidth box to increase the network bandwidth.

  • Select the Network interfaces options from the drop-down menu. Each VM instance can have one to eight network interfaces. Networks without subnetworks do not support instances with multiple network interfaces.

  • Add a new disk or attach an existing disk to a VM instance.

  • Secure the configuration by selecting all the check boxes, such as Secure boot, vTPM, integrity monitoring. You can manage the VM access, either by checking Control VM ccess through IAM permissions, or Block project-wide SSH keys. By default, when you connect to a VM using this console or gcloud, your SSH keys are generated automatically. You can also manually add the generated SSH keys by copying the public key from the machine which will be used for initiating SSH.

  • Enter the management details, such as, description, deletion protection, reservations, automation, and availability policies.

  • Enter Sole-tenancy such as node affinity labels and CPU over-commit details.

  • After specifying all the necessary details, click Create.