Group unmanaged VMs together Stay organized with collections Save and categorize content based on your preferences.
An unmanaged instance group is a collection of virtual machine (VM) instancesthat reside in a single project, zone, VPC network, and subnet.An unmanaged instance group is useful for grouping together VMs that requireindividual configuration settings or tuning. You can use an unmanaged instancegroup in a load balancer'sbackend service.
For VMs that require consistent configuration settings, you can use amanagedinstance group (MIG)that's based on aninstance template. Whenpossible, consider using managed instance groups instead of unmanaged ones. Tocreate a managed instance group, seeCreate a MIG.
You can add either type of instance group as a backend to a Google Cloudload balancer. For more information, seeCloud Load Balancingoverview. For the number of VMsper instance group that Cloud Load Balancing supports, seeVMs per instancegroup.
To learn more about instance groups, seeInstance groupsoverview.
Note: While you can create a regional managed instance group, you cannot createa regionalunmanaged instance group.Before you begin
- Read about thedifferencebetween managed and unmanaged instance groups.
- If you haven't already, set upauthentication. Authentication verifies your identity for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine by selecting one of the following options:
Select the tab for how you plan to use the samples on this page:
Console
When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloud
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.- Set a default region and zone.
REST
To use the REST API samples on this page in a local development environment, you use the credentials you provide to the gcloud CLI.
Install the Google Cloud CLI. After installation,initialize the Google Cloud CLI by running the following command:
gcloudinit
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
Note: If you installed the gcloud CLI previously, make sure you have the latest version by runninggcloud components update.For more information, seeAuthenticate for using REST in the Google Cloud authentication documentation.
Working with unmanaged instance groups
Creating groups
Unlikemanaged instance groups,unmanaged instance groups are just collections of distinct VMs that do not sharea common instance template. You simply create a group, and add individualVMs to the group.
Console
- In the Google Cloud console, go to theInstance groups page.
- ClickCreate instance group.
- ClickNew unmanaged instance group.
- Enter a name for the unmanaged instance group.
- UnderLocation, select a region and a zone.
- Select aNetwork andSubnetwork.
- UnderVM instances, select the VMs to add to this group.
- ClickCreate.
gcloud
To create a new unmanaged instance group, use theinstance-groups unmanagedcreatecommand:
gcloud compute instance-groups unmanaged createinstance-group-name \ --zone=zone
Replace the following:
instance-group-name: The name of the group youwant to create.zone: The zone where you want to create the group.
REST
To create an unmanaged instance group with REST, send aPOSTrequest using theinstanceGroups.insertmethod:
POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups{ "name": "instance-group-name"}Replace the following:
instance-group-name: The name of the group youwant to create.zone: The zone where you want to create the group.project-id: The project ID for the projectcontaining the group.
When you create a new unmanaged instance group with Google Cloud CLI or REST,no VMs are added to it automatically. You canadd VMs to the unmanaged instancegroup manually.
Listing and describing groups
Retrieve a list of existing unmanaged instance groups.
Console
In the Google Cloud console, theInstance groups page lists existingunmanaged andmanaged instance groups.
gcloud
To list all unmanaged instance groups in your project with theGoogle Cloud CLI, useinstance-groups unmanagedlist:
gcloud compute instance-groups unmanaged list
To see information about a specific unmanaged instance group, use theinstance-groups unmanageddescribecommand:
gcloud compute instance-groups unmanaged describeinstance-group-name \ --zone=zone
Replace the following:
instance-group-name: The name of the group todescribe.zone: The zone of the group.
REST
To list instance groups with REST, send aGET request using theinstanceGroups.listmethod:
GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups
To obtain information about a specific unmanaged instance group with theAPI, send aGET request using theinstanceGroups.getmethod:
GET https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name
Replace the following:
instance-group-name: The name of the group todescribe.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.
Deleting groups
Unlike a managed instance group, deleting an unmanaged instance group does notdelete any of the VMs within the group. Deleting an unmanaged instance grouponly removes the logical grouping of VMs.
You can't delete an instance group if the group is a backend of aGoogle Cloud load balancer. You must firstremove thebackend from the backendservice.
Console
- In the Google Cloud console, go to theInstance groups page.
- Select one or more unmanaged instance groups from the list.
- ClickDelete to remove the groups. The groups are removed, but theVMs in the groups are not deleted.
gcloud
To delete an unmanaged instance group, use theinstance-groups unmanageddeletecommand:
gcloud compute instance-groups unmanaged deleteinstance-group-name \ --zone=zone
Replace the following:
instance-group-name: The name of the group youwant to delete.zone: The zone of the group.
REST
To delete an unmanaged instance group with REST, send aDELETErequest using theinstanceGroups.deletemethod:
DELETE https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name
Replace the following:
instance-group-name: The name of the group youwant to delete.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.
Group membership
Adding VMs
After youcreate an unmanaged instance group,you can add VMs to the group. However, you can only group VMs together ifthe first or only network interface (nic0) of each VM is attached to thesame VPC network. The maximum number of VMs that you can add toan unmanaged instance group is 2,000. If you want to add more than 2,000 VMs tothe group,contact support.
Console
- In the Google Cloud console, go to theInstance groups page.
- Under theName column of the list, click the name of the instancegroup where you want to add your VMs. A page opens with the instancegroup properties and a list of VMs that are already part of the group.
- ClickEdit to modify this unmanaged instance group.
- UnderVM instances select one or more existing VMs to add to thegroup. You can only select VMs that are in the same zone,VPC network, and subnet as existing VMs.
- ClickSave to add the new VMs to the group.
gcloud
To add instances to an unmanaged instance group, use theinstance-groupsunmanagedadd-instancescommand:
gcloud compute instance-groups unmanaged add-instancesinstance-group-name \ --zone=zone \ --instances=list-of-VM-names
Replace the following:
instance-group-name: The name of the group towhich you want to add VMs.zone: The zone of the group.list-of-VM-names: A comma-delimited list ofVMs in the same zone, VPC network, and subnet.
REST
To add VMs to an unmanaged instance group, send aPOSTrequest using theinstanceGroups.addInstancesmethod:
POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name/addInstances { "instances": [ { "instance": "https://www.googleapis.com/compute/v1/projects/project-id/zones/zone/instances/instance-1-name", "instance": "https://www.googleapis.com/compute/v1/projects/project-id/zones/zone/instances/instance-2-name", .... } ] }Replace the following:
instance-group-name: The name of the group towhich you want to add VMs.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.instance-1-nameandinstance-2-name: These are names of the VMs, inthe same zone, VPC network, and subnet, that you want toadd to the group.
Listing VMs
You can retrieve a list of member VMs in an unmanaged instance group.
Console
- In the Google Cloud console, go to theInstance groups page.
- Under theName column of the list, click the name of theunmanaged instance group that you want to view. A page with the list ofinstances that are included in the group appears.
gcloud
To list the VMs in an unmanaged instance group, use theinstance-groupsunmanagedlist-instancescommand:
gcloud compute instance-groups unmanaged list-instancesinstance-group-name \ --zone=zone
Replace the following:
instance-group-name: The name of the group whosemembers you want to list.zone: The zone of the group.
REST
To list VMs in an unmanaged instance group, send aPOSTrequest using theinstanceGroups.listInstancesmethod:
POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name/listInstances
Replace the following:
instance-group-name: The name of the group whosemembers you want to list.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.
Removing VMs
You can remove VMs from an unmanaged instance group. Removing a VM from theinstance group does not delete the VM.
Note: If the group is attached to backend service that hasconnectiondrainingenabled, it can take up to 60 secondsafter the connection draining timeoutfor the VM instance to be removed from the unmanaged instance group.Console
- In the Google Cloud console, go to theInstance groups page.
- Under theName column of the list, click the name of the instancegroup from which you want to remove VMs. A page opens with the instancegroup properties and a list of VMs that are included in the group.
- In the list, select one or more VMs that you want to remove from thegroup.
- ClickRemove from group. VMs that you remove from an unmanagedinstance group continue to exist and run unless you stop or delete them.
gcloud
To remove VMs from an unmanaged instance group, use theinstance-groupsunmanagedremove-instancescommand:
gcloud compute instance-groups unmanaged remove-instancesinstance-group-name \ --zone=zone \ --instances=list-of-VM-names
Replace the following:
instance-group-name: The name of the group thatcontains instances to remove.zone: The zone of the group.list-of-VM-names: A comma-delimited list ofVMs that you want to remove from the group.
REST
To remove VMs from an unmanaged instance group with, send aPOSTrequest using theinstanceGroups.removeInstancesmethod. You can simultaneously remove multiple VMs as shown below:
POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name/removeInstances{ "instances": [ { "instance": "https://www.googleapis.com/compute/v1/projects/project-id/zones/zone/instances/instance-1-name", "instance": "https://www.googleapis.com/compute/v1/projects/project-id/zones/zone/instances/instance-2-name", .... } ]}Replace the following:
instance-group-name: The name of the group thatcontains instances to remove.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.instance-1-nameandinstance-2-name: These are names of the VMsthat you want to disassociate from the group.
Working with named ports
Named ports are key-value pairs that represent a port's name and number. Theport name represents a name of a service or application. The port numberrepresents the port that service or application runs on.
Named ports are used by Cloud Load Balancing. Load balancersthat act as proxies subscribe to a single named port in their backend serviceconfiguration. The port's name is translated to a port number based on the namedport's mapping of each instance group backend.
For example, a backend service can subscribe to a port that is namedhttp-port.The backend instance group can have a port namedhttp-port:80. The backendinstance group instructs the load balancer to send traffic to a VM in the groupon port 80 using a protocol (such as TCP). The protocol is defined in the loadbalancer's backend service.
Named ports are simple metadata used byproxy load balancers. Namedports do not control network or firewall resources in Compute Engine.
Multiple port numbers for a named port
You can assign multiple ports for each service name.You can also assign multiple service names for each port.
Keep in mind the following points:
- Traffic is balanced between all ports with the same port name.
- A given backend service can only forward traffic to one named port at a time.
If you use multiple port numbers for a named port, the ports must all be forthe same application.
For example,
http:80,http:8080works, buthttp:80,http:443doesn't work because port 80 generally doesn't support TLS.
You can assign multiple named ports in an instance group. To illustrate,consider an example backend service that subscribes to the named porthttp-port, and that has two backend instance groups:
instance-group-awith a named port ofhttp-port:80instance-group-bwith a named port ofhttp-port:79
This backend service sends traffic to port 80 for VMs ininstance-group-a andport 79 for VMs ininstance-group-b.
When you add the same instance group to multiple backend services (for multipleload balancers) and the instance group serves different ports on each loadbalancer, don't add all the port numbers to a single named port. Instead createa unique named port and map it to a set of ports that each backend serviceshould serve.
For example, suppose you have three applications, each with its own loadbalancer. Each application has its own port number: 81 forapp1, 82forapp2, and 83 forapp3. Assuming that all three backend services areusing a common instance group, assign the named ports for this instance groupas[app1:81, app2:82, app3:83].
Named ports and health checks
For a named port with multiple port numbers on a backend service to work in anexternal Application Load Balancer or an internal Application Load Balancer, the health check must have the--use-serving-port flag instead of a specific port number. This option is notavailable in the Google Cloud console. To set--use-serving-port, you must use theGoogle Cloud CLI or the API.
For example, suppose you have an application that load balances the traffic onthree different ports (81, 82, 83) on the same backend service with a singleinstance group. You can assign the ports for this instance groups as[app:81,82, 83]. The health check in this scenario must have the--use-serving-portflag.
For more information, see theload balancing health checkdocumentation.
Named ports and firewall rules
Named ports donot create or modify Google Cloudfirewallrules. To permit traffic to backend VMs, you must stillcreate the necessary firewall rules.
Named ports and backend services
In addition to the instance group configuration, you must also configurethe backend service. For example, suppose you set the named port on an instancegroup with the namemy-service-name and the port8888:
gcloud compute instance-groups set-named-ports my-unmanaged-ig \ --named-ports=my-service-name:8888
Then you must refer to the named port in the backend service configuration withthe--port-name on the backend service set tomy-service-name:
gcloud compute backend-services update my-backend-service \ --port-name=my-service-name
Creating named ports
Console
- In the Google Cloud console, go to theInstance groups page.
- Under theName column of the list, click the name of the instancegroup where you want to specify named ports.A page opens with the instance group properties.
- ClickEdit to modify this unmanaged instance group.
- In thePort mapping section, clickAdd port, andenter a port name and its number. Add or remove other named ports asnecessary.
- ClickSave to update the list of named ports for the unmanagedinstance group.
gcloud
To add named ports to an unmanaged instance group, use theinstance-groupsunmanaged set-named-portscommand:
gcloud compute instance-groups unmanaged set-named-portsinstance-group-name \ --zone=zone \ --named-ports=port-name:port-number,...
To list named ports in an unmanaged instance group use theinstance-groups unmanaged get-named-ports command:
Set one or more named ports using theset-named-ports command:
gcloud compute instance-groups unmanaged set-named-portsINSTANCE_GROUP \ --named-portsPORT_NAME:PORT,PORT_NAME:PORT
For example:
gcloud compute instance-groups unmanaged set-named-portsINSTANCE_GROUP \ --named-ports name1:80,name2:8080
To assign multiple ports to each service name or multiple names for eachservice, create more than one entry for each name or port. For example, ifports10,20, and80 are for the same application, you can assignname1 to all of those ports. Additionally, you might assign two names,name2 andname3 to port8080. Finally, you might assign port9000 toname4, as in the following example:
gcloud compute instance-groups unmanaged set-named-portsINSTANCE_GROUP \ --named-ports name1:10,name1:20,name1:80,\ name2:8080,name3:8080,\ name4:9000
To remove all named ports from an unmanaged instance group with theGoogle Cloud CLI, useinstance-groups unmanagedset-named-portswith an empty list of named ports:
gcloud compute instance-groups unmanaged set-named-portsinstance-group-name \ --zone=zone \ --named-ports=""
In all the examples above, replace the following if present:
instance-group-name: The name of the instancegroup.zone: The zone of the group.port-nameandport-number:The port name and number represent a mapping from a name you choose toa port number. You can specify multiple mappings separated by commas; forexample,port-one:80,port-two:8080is a valid list of named ports.
REST
Describe the instance group and note thefingerprint.
To add named ports, send a
POSTrequest using theinstanceGroups.setNamedPortsmethod. If you want to remove all named ports, setnamedPortsto anempty list.POST https://compute.googleapis.com/compute/v1/projects/project-id/zones/zone/instanceGroups/instance-group-name/setNamedPorts{ "fingerprint": "fingerprint", "namedPorts": [ { "name": "port-name", "port":port-number }, { "name": "port-name", "port":port-number }, .... ]}Replace the following:
instance-group-name: The name of the instancegroup.zone: The zone of the group.project-id: The project ID for the projectcontaining the group.port-nameandport-number: The port name and number representa mapping from a name you choose to a port number.fingerprint: This is the fingerprint from theprevious step.
What's next
- Create amanaged instance group with VMs in a single zone.
- Create amanaged instance group with VMs in multiple zones in a region.
- Learn aboutCloud Load Balancing.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-09 UTC.