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/create-mig-with-basic-stateful-disks below:

Create a MIG with stateful disks | Compute Engine Documentation

Create a MIG with stateful disks

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

This document describes how to create a managed instance group (MIG) that preserves the data on disks with a given device name for all of the MIG's VMs, even in the event of VM recreation—for example when a VM in the MIG is autohealed, updated, or recreated. Preserving disks is useful for certain workloads—for example, for databases or legacy applications.

In addition to preserving disks for all VMs in the group, you can also configure a stateful MIG for the following:

For more information, see the stateful MIG overview.

You can also read about other basic scenarios for creating a MIG.

Before you begin Limitations

A MIG with stateful configuration—a stateful MIG—has the following limitations:

To see the full list of MIG limitations, which varies based on the configuration that you use, see MIG limitations.

Create a MIG with stateful disks

Use the Google Cloud console, the gcloud CLI, Terraform, or REST.

Pro Tip: Consider storing data on an additional persistent disk and keeping the boot disk, containing the application, stateless. Such a configuration makes your application resilient to boot disk file system corruption. This configuration also simplifies VM updates because the MIG can recreate boot disks based on the immutable source image that you specify in the MIG's instance template.

Permissions required for this task

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

Console
  1. Go to the Instance groups page.

    Go to Instance groups

    The remaining steps appear in the Google Cloud console.

  2. Click Create instance group .
  3. Select the New managed instance group (stateful) option.
  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. In the Number of instances field, specify the initial number of VMs you need in this group.
  7. In the Stateful configuration section, under Group config, click the disk you want to make stateful, then perform the following steps.
    1. In the Stateful section, select Yes.
    2. In the On permanent instance deletion list, choose whether you want to detach the disk or delete the disk when you permanently delete the VM.
    3. To save the settings, click Done.
  8. To create the MIG, click Create .
gcloud

To specify which disks from the instance template should be stateful on MIG creation, use the --stateful-disk flag with the gcloud compute instance-groups managed create command:

gcloud compute instance-groups managed create INSTANCE_GROUP_NAME \
    --template INSTANCE_TEMPLATE_URL \
    --size SIZE \
    --stateful-disk device-name=DEVICE_NAME[,auto-delete=DELETE_RULE]

Replace the following:

Note: You can see the device names of disks that are defined in an instance template by running the gcloud compute instance-templates describe command. 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 specify which disks from the instance template should be stateful on MIG creation, include the stateful_disk block. The following sample creates a zonal MIG with stateful disks. For more information about the resource that is used in the sample, see google_compute_instance_group_manager resource.

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

REST

To specify which disks from the instance template should be stateful on MIG creation, include them in the statefulPolicy field in your request body. For a zonal MIG, use the instanceGroupManagers.insert method or for a regional MIG, use the regionInstanceGroupManagers.insert method.

POST https://compute.googleapis.com/compute/v1/projects/PROJECT/zones/ZONE/instanceGroupManagers

{
  "name": "NAME",
  "versions": [
    {
      "instanceTemplate": "INSTANCE_TEMPLATE_URL"
    }
  ],
  "targetSize": SIZE,
  "statefulPolicy": {
    "preservedState": {
      "disks": {
        "DEVICE_NAME": {"autoDelete": "DELETE_RULE" },
        "DEVICE_NAME": {"autoDelete": "DELETE_RULE" }
      }
    }
  }
}

Replace the following:

Note: You can see the device names of disks that are defined in an instance template by calling the instanceTemplates.get method and reading the instanceTemplates.disks[].deviceName field in the response. 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."],[[["This document guides users on creating managed instance groups (MIGs) that preserve data on specified disks across VM operations like autohealing, updates, or recreation, which is useful for workloads such as databases."],["Stateful MIGs offer the ability to preserve instance-specific disks, metadata, and IP addresses, extending beyond basic data persistence."],["Creating a stateful MIG involves defining stateful disks during MIG creation, through the console, gcloud CLI, Terraform, or REST API, by specifying device names and delete rules."],["When configuring stateful disks, you can choose whether to detach or delete the disk when a VM is permanently deleted, but disks are always preserved during VM autohealing, update, or recreation regardless of the setting."],["Stateful MIGs have limitations such as not being compatible with autoscaling and requiring the `RECREATE` replacement method for automated rolling updates, along with needing proactive redistribution to be disabled for stateful regional MIGs."]]],[]]


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