A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://cloud.google.com/compute/docs/instance-groups/regional-mig-set-target-distribution-shape below:

Set a target distribution shape for VMs in a regional MIG | Compute Engine Documentation

Skip to main content Set a target distribution shape for VMs in a regional MIG

Stay organized with collections Save and categorize content based on your preferences.

If you use a regional managed instance group (MIG), you can set that MIG's target distribution shape to one of the following options:

To use reserved VMs in a regional managed instance group, create identical reservations with the same name in each applicable zone. Then, target those reservations by name in the group's instance template.

To help you choose a shape, see the comparison table, use cases, and how distribution shapes work.

Set a target distribution shape when creating your regional MIG or update the target shape of an existing regional MIG.

Before you begin Limitations Creating a group with a target distribution shape Note: If you set your regional MIG's target shape to ANY or ANY_SINGLE_ZONE, you cannot use autoscaling. You must set the target distribution shape to EVEN or BALANCED to be able to turn on autoscaling.

To create your group, select its zones, and set its target distribution shape, use the Google Cloud console, the gcloud CLI, Terraform, or REST.

Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to the Instance groups page

  2. Click Create instance group to create a new instance group.
  3. Select one of the New managed instance group options: stateless (default) or stateful.
  4. Assign a name and optionally a description to your instance group.
  5. Choose an instance template for the instance group or create a new one.
  6. Specify the number of VMs for this group. For highly available workloads, remember to provision enough VMs to support your application if a zone failure happens.
  7. Under Location, select Multiple zones.
  8. Choose a region and select the zones you want to use.

  9. Choose a target distribution shape.

    1. If you want to select Any or Any single zone, in the Autoscaling section, click Autoscaling mode and choose Delete autoscaling configuration.
    2. If you want to select Any single zone or Balanced, in the Instance redistribution section, don't select Allow instance redistribution.
  10. Continue with the rest of the MIG creation process.

gcloud

Use the gcloud compute instance-groups managed create command and include the --target-distribution-shape flag.

gcloud compute instance-groups managed create INSTANCE_GROUP_NAME \
    --template TEMPLATE \
    --size SIZE \
    --region REGION \
    --zones ZONES \
    --target-distribution-shape SHAPE

Replace the following:

For example, to create a regional MIG with a balanced target distribution shape, set the --target-distribution-shape flag to balanced.

gcloud compute instance-groups managed create example-rmig \
    --template example-template \
    --size 30 \
    --zones us-east1-b,us-east1-c \
    --target-distribution-shape balanced \
    --instance-redistribution-type none
Terraform

If you haven't already created an instance template, which specifies the machine type, boot disk image, network, and other VM properties that you want for each VM in your MIG, create an instance template.

To create a regional MIG, use the google_compute_region_instance_group_manager resource.

The following example creates a regional MIG with BALANCED target distribution shape.

To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.

REST

Call the regionInstanceGroupManagers.insert method. In the request body, include the distributionPolicy property, and set its targetShape field.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers

{
    "name": INSTANCE_GROUP_NAME,
    "instanceTemplate": "global/instanceTemplates/TEMPLATE",
    "targetSize": SIZE,
    "distributionPolicy": {
        "zones": [
            {"zone": "zones/ZONE1"},
            {"zone": "zones/ZONE2"},
            {"zone": "zones/ZONE3"},
        ],
        "targetShape": "SHAPE"
    }
}

Replace the following:

Changing the target distribution shape of an existing group

You can change the target distribution shape in an existing regional MIG but with the following limitations:

Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to the Instance groups page

  2. In the Name column of the list, click the name of the instance group where you want to change the target distribution shape.
  3. Click Edit to modify this managed instance group.
  4. Click Location to expand the section.
  5. In the Target distribution shape list, select the shape that you want.
  6. Click Save to apply the changes.
gcloud

Use the gcloud compute instance-groups managed update command and include the --target-distribution-shape flag.

gcloud compute instance-groups managed update INSTANCE_GROUP_NAME \
    --target-distribution-shape SHAPE

Replace the following:

REST

Call the regionInstanceGroupManagers.patch method. In the request body, include the distributionPolicy property, and set its targetShape field.

PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME

{
    "distributionPolicy": {
        "targetShape": "SHAPE"
    }
}

Replace the following:

Viewing the configured instance distribution policy Permissions required for this task

To perform this task, you must have the following permissions:

Console
  1. In the Google Cloud console, go to the Instance groups page.

    Go to the Instance groups page

    If you have existing instance groups, the page lists those groups.
  2. Click the name of the instance group that you want to examine. A page opens with the instance group properties and a list of instances that are included in the group.
  3. Click Details.
  4. In the Location section, look for Target distribution shape.
gcloud

Run the gcloud compute instance-groups managed describe command.

gcloud compute instance-groups managed describe INSTANCE_GROUP_NAME \
    --region REGION

The command returns the group's details, including the distributionPolicy.targetShape field:

...
distributionPolicy:
  targetShape: BALANCED
  zones:
  - zone: https://www.googleapis.com/compute/v1/projects/my-project/zones/us-central1-f
  ...
name: my-group
region: https://www.googleapis.com/compute/v1/projects/my-project/regions/us-central1
...
REST

Construct a GET request to the regionInstanceGroupManagers.get method.

GET https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME

Replace the following:

The target distribution shape is returned in the distributionPolicy.targetShape field. For example:

{
  "name": "my-instance-group",
  "distributionPolicy": {
    "targetShape": "BALANCED",
  },
  "targetSize": 50,
  ...
}
What's next

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-08-07 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["Regional Managed Instance Groups (MIGs) allow you to choose a target distribution shape that determines how VMs are distributed across zones, with options including EVEN, BALANCED, ANY, and ANY_SINGLE_ZONE, each recommended for different workload types."],["The `EVEN` distribution shape aims to maintain an equal number of VMs in each zone, the `BALANCED` prioritizes VM creation where resources are available while keeping an even distribution, the `ANY` focuses on fulfilling the requested number of VMs with current constraints, and the `ANY_SINGLE_ZONE` only creates VMs within a single zone."],["You can create a new regional MIG with a specified target distribution shape by using the Google Cloud console, the `gcloud` CLI, Terraform, or REST API, allowing you to configure zones and the distribution policy during group creation."],["Existing regional MIGs can have their target distribution shape updated, however there are certain limitations for changing the target distribution shape to `BALANCED`, `ANY_SINGLE_ZONE`, or `EVEN`, like first disabling proactive redistribution."],["Viewing the currently configured instance distribution policy can be done via the console, `gcloud` CLI or REST API, which allows the user to see the target distribution shape and zones."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4