GCP | How to create Unmanaged instance groups from Cloud Shell

In GCP An instance group is a collection of virtual machine (VM) instances that can managed as a single entity.

  • Login to Google Cloud Console
  • Click Activate Cloud Shell to open Cloud Shell.
  • Create an unmanaged instance group with following command
    1. Name of instance group : test-ig
    2. zone : us-central1-a
    
    gcloud compute instance-groups unmanaged create test-ig \
        --zone us-central1-a
    
    

  • You should see below output on after running the command
  • 
    Created [https://www.googleapis.com/compute/v1/projects/********/zones/us-central1-a/instanceGroups/test-ig].
    NAME     LOCATION       SCOPE  NETWORK  MANAGED  INSTANCES
    test-ig  us-central1-a  zone
    
    

  • Add instances to instance group "test-ig"
    1. Create first VM in same zone as of instance group with name "vm1"
    2. Create second VM in same zone as of instance group with name "vm2"

  • Run following command to add vms to the instance group
  • 
    
    gcloud compute instance-groups unmanaged add-instances test-ig \
        --instances=vm1,vm2 --zone us-central1-a
    
    

    Category: GCP