Stay organized with collections Save and categorize content based on your preferences.
By configuring stateful IP addresses in a managed instance group (MIG), you ensure that IP addresses are preserved when VM instances in the group are autohealed, updated, and recreated.
You can preserve internal and external IPv4 addresses. You can configure IP addresses to be assigned automatically or assign specific IP addresses to each VM instance in a MIG.
Before you beginSelect the tab for how you plan to use the samples on this page:
ConsoleWhen you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.
gcloudInstall the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud init
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
.To use the Terraform samples on this page in a local development environment, install and initialize the gcloud CLI, and then set up Application Default Credentials with your user credentials.
Install the Google Cloud CLI.
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
.
If you're using a local shell, then create local authentication credentials for your user account:
gcloud auth application-default login
You don't need to do this if you're using Cloud Shell.
If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.
For more information, see Set up authentication for a local development environment.
RESTTo 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.
If you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
For more information, see Authenticate for using REST in the Google Cloud authentication documentation.
A MIG with stateful IP addresses has the following limitations:
IPv6 addresses are not supported.
Internal IP addresses are not supported in networks that have no subnetworks–for example, legacy networks.
A MIG with stateful configuration—a stateful MIG—has the following limitations:
RECREATE
.NONE
) to prevent deletion of stateful instances by automatic cross-zone redistribution.You are charged for external IP addresses according to networking pricing.
Caution: Unused reserved external static IP addresses incur charges, so make sure to delete them if you don't intend to keep them for future use. When configuring stateful IPs, you can use the auto-delete rule to automatically delete a static IP address when its instance is permanently deleted. When to use stateful IP addressesPreserving instances' IP addresses is useful in the following scenarios:
Configuring stateful IP addresses for all VMs in a MIG is useful in the following scenarios:
To maintain static internal or external IP addresses for existing and future VM instances in the group, configure that in the stateful policy.
When you add stateful IP address configuration to the group's stateful policy, the MIG applies the configuration in the following way:
For existing instances without external IP addresses, the MIG assigns and reserves static IP addresses, and adds access configuration to the corresponding network interface with the following default values:
"accessConfigs": [ { "kind": "compute#accessConfig", "name": "External NAT", "natIP": "XX.XX.XX.XX", "networkTier": "PREMIUM", "type": "ONE_TO_ONE_NAT" } ]
To reserve a static IP address, the MIG creates an Address resource.
Note: All VM instances have a network interface with the namenic0
and this network interface is used by default when you configure a stateful IP.
You have the option to create instances that have multiple network interfaces by setting multiple network interfaces in your group's instance template. In this case, separately specify each internal or external IP that you want to make stateful for each network interface.
Configuring stateful IP addresses on MIG creationUse the Google Cloud console, gcloud CLI, Terraform, or REST.
Permissions required for this taskTo perform this task, you must have the following permissions:
instanceGroupManagers.insert
methodregionInstanceGroupManagers.insert
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectIn the Google Cloud console, go to the Instance groups page.
Select your project and click Continue.
Click Create instance group.
Select New managed instance group (stateful).
Specify a Name for the instance group.
Select an Instance template.
Under Number of instances, specify the number of instances that you want to include in the managed instance group.
Under Stateful configuration, expand the External IP and the Internal IP sections to configure those IP address types as stateful.
Click Create.
When creating a MIG, to specify which IP addresses in network interfaces from the instance template should be stateful, use one or multiple of the following flags with the gcloud compute instance-groups managed create
command:
--stateful-internal-ip
to mark an internal IP address of a given network interface as stateful.--stateful-external-ip
to mark an external IP address of a given network interface as stateful.gcloud compute instance-groups managed create INSTANCE_GROUP_NAME \ --template INSTANCE_TEMPLATE \ --size SIZE \ --instance-redistribution-type NONE \ --stateful-internal-ip [enabled | interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ --stateful-external-ip [enabled | interface-name=NI_NAME][,auto-delete=DELETE_RULE]
Replace the following:
enabled
option is required and the primary network interface named nic0
is assumed by default. If you have multiple network interfaces, you can specify this flag for each IP in each network interface.DELETE_RULE: (Optional.) Prescribes what should happen to the associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
never
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.on-permanent-instance-deletion
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
Example
You need to create a regional group of VM instances with static internal IP addresses for the default and custom networks and static external IP addresses only for the default network. You want the addresses to be assigned automatically, but need them to be preserved through instance autohealing, updates, and recreation events. You store instance configuration in an instance template named node-template
.
To create the group, run the following command:
gcloud compute instance-groups managed create example-group \ --region us-east1 \ --template node-template \ --base-instance-name node \ --instance-redistribution-type NONE \ --size 3 \ --stateful-internal-ip interface-name=nic0,auto-delete=on-permanent-instance-deletion --stateful-internal-ip interface-name=nic1,auto-delete=on-permanent-instance-deletion --stateful-external-ip enabled,auto-delete=on-permanent-instance-deletion
The internal IPs within the nic0
and nic1
network interfaces and the external IP within the nic0
network interface are configured as stateful for all instances in the group. The group automatically reserves static internal and external IP addresses for each instance. Because the auto-delete
flag is set to on-permanent-instance-deletion
, the group will automatically delete the static IP address reservations when you delete the associated instances or the whole group.
To verify that the internal IPs within the nic0
and nic1
network interfaces and the external IP within the nic0
network interface are configured as stateful, run the following command:
gcloud compute instance-groups managed describe example-group \ --zone us-east1-c
The output resembles the following:
baseInstanceName: node ... name: example-group ... statefulPolicy: preservedState: internalIPs: nic0: autoDelete: ON_PERMANENT_INSTANCE_DELETION nic1: autoDelete: ON_PERMANENT_INSTANCE_DELETION externalIPs: nic0: autoDelete: ON_PERMANENT_INSTANCE_DELETION ...
You can see that the group's stateful policy declares internal IPs within the nic0
and nic1
network interfaces and external IPs within the nic0
network interface as stateful with the rule to delete static IP reservations on permanent instance deletion.
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.
When creating a MIG, to specify which IP addresses within network interfaces from the instance template should be stateful, use one or multiple of the following blocks:
stateful_internal_ip
to mark an internal IP address of a given network interface as stateful.stateful_external_ip
to mark an external IP address of a given network interface as stateful.The following sample configures stateful IP addresses when creating a regional MIG. For more information about the resource used in the sample, see google_compute_region_instance_group_manager
resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
RESTWhen creating a MIG, to specify which IP addresses within network interfaces from the instance template should be stateful, include them in the statefulPolicy
field in the request body of the instanceGroupManagers.insert
or regionInstanceGroupManagers.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT/regions/REGION/instanceGroupManagers { "name": "INSTANCE_GROUP_NAME", "versions": [ { "instanceTemplate": "global/instanceTemplates/INSTANCE_TEMPLATE" } ], "targetSize": SIZE, "statefulPolicy": { "preservedState": { "internalIPs": { "NI_NAME": {"autoDelete": "DELETE_RULE" } }, "externalIPs": { "NI_NAME": {"autoDelete": "DELETE_RULE" } } } }, "updatePolicy": { "instanceRedistributionType": "NONE" } }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.enabled
option is required and the primary network interface named nic0
is assumed by default. If you have multiple network interfaces, you can specify multiple NI_NAMES.DELETE_RULE: (Optional) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
NEVER
: (Default) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.ON_PERMANENT_INSTANCE_DELETION
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
Example
You need to create a regional group of VM instances with static internal IP addresses for the default and custom networks and static external IP addresses only for the default network. You want the addresses to be assigned automatically, but need them to be preserved through instance autohealing, updates, and recreation events. You store instance configuration in an instance template named node-template
.
To create the group, use the regionInstanceGroupManagers.insert
method:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers { "name": "example-group", "baseInstanceName": "node", "versions": [ { "instanceTemplate": "global/instanceTemplates/node-template" } ], "targetSize": 3, "statefulPolicy": { "preservedState": { "internalIPs": { "nic0": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" }, "nic1": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" } } "externalIPs": { "nic0": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" } } } }, "updatePolicy": { "instanceRedistributionType": "NONE" } }
The internal IPs within the nic0
and nic1
network interfaces and the external IPs within the nic0
network interface are configured as stateful for all instances in the group. The group automatically reserves static internal and external IP addresses for each instance. Because the auto-delete
field is set to ON_PERMANENT_INSTANCE_DELETION
, the group will automatically delete the static IP address reservations when you delete associated instances or the whole group.
Use the regionInstanceGroupManagers.get
method to verify that the internal IPs within the nic0
and nic1
network interfaces and external IPs within the nic0
network interface are configured in the stateful policy of the new regionInstanceGroupManagers
resource:
GET https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/example-group
The response contains the configured stateful policy:
{ "name": "example-group", "baseInstanceName": "node", ... "statefulPolicy": { "preservedState": { "internalIPs": { "nic0": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" }, "nic1": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" } } "externalIPs": { "nic0": {"autoDelete": "ON_PERMANENT_INSTANCE_DELETION" } } } } ... }
You can see that the group's stateful policy declares internal IPs within the nic0
and nic1
network interfaces and external IPs within the nic0
network interface as stateful with the rule to delete the associated static IP address reservations on permanent instance deletion.
If you run a workload on a stateless MIG (a MIG without any stateful configuration) and the workload requires static IP addresses, you can configure IP addresses already assigned to the managed VM instances to become stateful. This ensures that the IP addresses of your existing VMs are preserved on instance autohealing, updates, and recreation events. You can optionally keep the static IP address reservations after the instances have been deleted.
By configuring a stateful policy for IP addresses in an existing MIG, you can do the following:
The MIG applies the updated configuration in the stateful policy automatically and asynchronously to all instances. Updates to IP address configurations in a stateful policy don't disrupt running VM instances. To learn more, read about applying stateful policy updates.
Permissions required for this taskTo perform this task, you must have the following permissions:
instanceGroupManagers.patch
methodregionInstanceGroupManagers.patch
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectIn the Google Cloud console, go to the Instance groups page.
Click the name of the instance group for which you want to specify stateful IP addresses.
Click Edit to modify the managed instance group.
Click Stateful & per-instance configuration to expand the section.
In the Group config section, click the External IP and the Internal IP that you want to make stateful.
To specify which IP addresses should be stateful or to update the stateful IP configuration for an existing MIG, use one or multiple --stateful-internal-ip
or --stateful-external-ip
flags with the gcloud compute instance-groups managed update
command.
gcloud compute instance-groups managed update INSTANCE_GROUP_NAME \ --stateful-internal-ip [enabled | interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ --stateful-external-ip [enabled | interface-name=NI_NAME][,auto-delete=DELETE_RULE]
Replace the following:
enabled
option is required and the primary network interface named nic0
is assumed by default. If you have multiple network interfaces, you can specify this flag for each IP in each network interface.DELETE_RULE: (Optional.) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
never
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.on-permanent-instance-deletion
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
If a specified IP address is already configured in the stateful policy for a given network interface, the command updates the configuration.
Example
You need to expose a file server, running on a stateful MIG named example-fs-group
, to external users through static external IP addresses. The instances in the group have ephemeral external IP addresses. You must make sure that the IP addresses are preserved on instance autohealing and updates so that external users have continuous access to the servers through the published IP addresses. You also need to keep the IP addresses reserved for continuity in the event of unintended group deletion.
Update the MIG to define the external IP addresses as stateful by using the following command:
gcloud compute instance-groups managed update example-fs-group \ --stateful-external-ip enabled
As a result, the group promotes ephemeral external IP addresses within the nic0
network interface to static IP addresses for all managed instances asynchronously.
The external IP addresses are now preserved on instance autohealing, update, and recreation events. The associated static IP address reservations are unassigned and preserved on instance deletion because the unspecified auto-delete
rule is set to never
by default.
You can verify that the stateful external IP is configured in the stateful policy by running the gcloud compute instance-groups managed describe example-fs-group
command.
To specify which IP addresses should be stateful or to update the stateful IP configuration for an existing MIG, use the instanceGroupManagers.patch
or regionInstanceGroupManagers.patch
method:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME { "statefulPolicy": { "preservedState": { "internalIPs": { "NI_NAME": {"autoDelete": "DELETE_RULE" } }, "externalIPs": { "NI_NAME": {"autoDelete": "DELETE_RULE" } } } } }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.nic0
. If you have multiple network interfaces, you can specify multiple NI_NAMES.DELETE_RULE: (Optional) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
NEVER
: (Default) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.ON_PERMANENT_INSTANCE_DELETION
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
If a specified IP address is already configured in the stateful policy, the method patches the configuration.
Example
You need to expose a file server, running on a stateful MIG named example-fs-group
, to external users through static external IP addresses. The instances in the group have ephemeral external IP addresses. You must make sure that the IP addresses are preserved on instance autohealing and updates so that external users have continuous access to the servers through the published network interface. You also need to keep the IP addresses reserved for continuity in the event of unintended group deletion.
Patch the MIG to define the external IP addresses as stateful:
PATCH https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/example-fs-group { "statefulPolicy": { "preservedState": { "externalIPs": { "nic0": {"autoDelete": "NEVER" } } } } }
As a result, the group promotes ephemeral external IP addresses within the nic0
network interface to static IP addresses for all managed instances asynchronously.
The external IP addresses are now preserved on instance autohealing, update, and recreation events. The associated static IP address reservations will be unassigned and preserved on instance deletion because the autoDelete
rule is set to NEVER
.
Verify that the external IP address is configured in the stateful policy by viewing the regionInstanceGroupManagers
resource, returned by the regionInstanceGroupManagers.get
method.
You might need to configure a stateful IP address to become ephemeral–for example, for the following reasons:
You can remove stateful IP configuration from the group's stateful policy to declare an IP address within a given network interface as ephemeral for all managed instances.
Note: If stateful IP configuration for the same network interface is present in a per-instance configuration, the IP address remain stateful for an associated instance even if you remove its configuration from the stateful policy. In such case, to make the IP ephemeral, you must also remove the IP addresses configuration from the per-instance configuration.When you remove stateful IP configuration from the stateful policy, the MIG removes the IP addresses automatically and asynchronously from the preserved state of all instances in the group. This operation does not disrupt running VM instances. The IP addresses remain active on the instances, but are no longer stateful. When you recreate or update the instances, or when the instances are autohealed, the MIG unassigns the associated static IP addresses and auto-assigns ephemeral addresses. If you no longer need to keep the static external IP address reservations, you can now release them.
Note: Static IP addresses remain reserved after you remove stateful IP configuration from a MIG's stateful policy. Because the stateful configuration has been removed, the group no longer manages the static IP addresses. If you don't need to keep the static IP addresses, make sure to release the reservations to avoid unnecessary charges.To learn more, read the following documents:
To perform this task, you must have the following permissions:
instanceGroupManagers.patch
methodregionInstanceGroupManagers.patch
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectIn the Google Cloud console, go to the Instance groups page.
Click the name of the instance group from which you want to remove the stateful configuration for IP addresses.
Click Edit to modify the managed instance group.
Click Stateful & per-instance configuration to expand the section.
In the Group config section, expand the External IP and the Internal IP that you want to make stateless.
After you make the changes, click Save.
To specify which IP addresses from a MIG's stateful policy to make ephemeral, use the --remove-stateful-internal-ips
or --remove-stateful-external-ips
flag with the gcloud compute instance-groups managed update
command:
gcloud compute instance-groups managed update INSTANCE_GROUP_NAME \ --remove-stateful-internal-ips NI_NAME[,NI_NAME,...] \ --remove-stateful-external-ips NI_NAME[,NI_NAME,...]
Replace the following:
nic0
. If you've multiple network interfaces, you can specify multiple NI_NAMES.gcloud compute instance-group managed describe
command.
If you need to turn a stateful IP address from the default primary network interface named nic0
into an ephemeral IP address, you can also use the following command:
gcloud compute instance-groups managed update INSTANCE_GROUP_NAME \ --stateful-internal-ip disabled \ --stateful-external-ip disabled
Example
Your application has been exposed to users through published static external IP addresses of the VM instances in a MIG called example-group
. You have rearchitected your service by deploying a load balancer in front of the MIG and routing the traffic to the managed VMs through it. You no longer need to maintain the static external IP addresses and would like to make the external IP addresses of the VMs ephemeral.
To make the stateful external IP addresses of the VMs in a MIG ephemeral, run the following command:
gcloud compute instance-groups managed update example-group \ --remove-stateful-external-ips nic0
The MIG removes the static external IP addresses of the nic0
network interface automatically and asynchronously from the preserved state of all instances in the group. The external IP addresses remain active on the instances, but are no longer stateful. When you recreate or update the instances, or when the instances are autohealed, the MIG unassigns the associated static IP addresses and auto-assigns ephemeral addresses. If you no longer need to keep the static external IP address reservations, you can now release them.
To specify which IP addresses from a MIG's stateful policy to make ephemeral, remove each IP's configuration from the MIG's stateful policy using the instanceGroupManagers.patch
or regionInstanceGroupManagers.patch
method:
PATCH https://compute.googleapis.com/compute/v1/projects/PROJECT/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME { "statefulPolicy": { "preservedState": { "internalIPs": { "NI_NAME": null }, "externalIPs": { "NI_NAME": null } } } }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.nic0
. If you have multiple network interfaces, you can specify multiple NI_NAMES.instanceGroupManagers.get
or regionInstanceGroupManagers.get
method.
Example
Your application has been exposed to users through published static external IP addresses of the VM instances in a MIG called example-group
. You have rearchitected your service by deploying a load balancer in front of the MIG and routing the traffic to the managed VMs through it. You no longer need to maintain the static external IP addresses and would like to make the external IP addresses of the VMs ephemeral.
To make the stateful external IP addresses of the VMs in a MIG ephemeral, patch the MIG:
PATCH https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/example-group { "statefulPolicy": { "preservedState": { "externalIPs": { "nic0": null } } } }
The MIG removes the static external IP addresses of the nic0
network interface automatically and asynchronously from the preserved state of all instances in the group. The external IP addresses remain active on the instances, but are no longer stateful. When you recreate or update the instances, or when the instances are autohealed, the MIG unassigns the associated static IP addresses and auto-assigns ephemeral addresses. If you no longer need to keep the static external IP address reservations, you can now release them.
Configuring stateful IP addresses individually for VMs in a MIG is useful in the following scenarios:
Pro Tip: Where feasible, consider configuring and auto-assigning stateful IP addresses for all VM instances in a MIG, instead of assigning specific IP addresses individually to each instance. Maintaining a group's stateful policy is less work compared to maintaining a set of individual per-instance configurations.
Note: All VM instances have a network interface with the namenic0
and this network interface is used by default when you configure a stateful IP.
You have the option to create instances that have multiple network interfaces by setting multiple network interfaces in your group's instance template. In this case, separately specify each network interface that you need to make stateful.
Configuring static IP addresses on VM creation in a MIGYou can reserve and assign static IP addresses to specific instances when individually creating those instances in a MIG. This is useful for migrating a stateful application from existing standalone VMs to a stateful MIG in a situation when architecture, configuration, or users rely on specific static IP addresses.
When you manually create an instance in a MIG and supply a static IP address, the MIG performs the following actions:
To perform this task, you must have the following permissions:
instanceGroupManagers.createInstances
methodregionInstanceGroupManagers.createInstances
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectTo create an instance with a predefined static IP address, use the gcloud compute instance-groups managed create-instance
command with one or multiple of the following flags:
--stateful-internal-ip
to set a static internal IP address of a given network interface.--stateful-external-ip
to set a static external IP address of a given network interface.gcloud compute instance-groups managed create-instance INSTANCE_GROUP_NAME \ --instance INSTANCE_NAME \ --stateful-internal-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ --stateful-external-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE]
Replace the following:
nic0
is assumed by default. If you've multiple network interfaces, you can specify this flag for each IP in each network interface.ADDRESS: (Required.) Static IP address to assign to the instance in one of the following formats:
"projects/example-project/regions/us-east1/addresses/example-ip-name"
."130.211.181.55"
.
DELETE_RULE: (Optional.) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
never
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.on-permanent-instance-deletion
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
Example
You need to add one more VM instance to your proxy server cluster, running on a MIG named proxy-cluster
. You have created a static internal IP address reservation named proxy-node-03-ip
and need to assign it to the new node. You want to keep the IP address reservation even if you decide to delete the node in the future.
Run the following command to create the node:
gcloud compute instance-groups managed create-instance proxy-cluster \ --instance proxy-node-03 \ --stateful-internal-ip address="projects/example-project/regions/us-east1/addresses/proxy-node-03-ip",auto-delete=never
The command creates an instance named proxy-node-03
, assigns the provided static internal IP address named proxy-node-03-ip
to the instance, and stores stateful configuration for the IP in the corresponding per-instance configuration. Because the auto-delete
flag is set to never
, the IP remains reserved if you delete the instance later.
To create a VM with a predefined static IP address, use one or multiple of the following blocks:
preserved_state.internal_ip
to mark an internal IP address of a given network interface as stateful.preserved_state.external_ip
to mark an external IP address of a given network interface as stateful.The following sample configures static IP addresses on VM creation in a regional MIG. For more information about the resource used in the sample, see google_compute_region_per_instance_config
resource. For a zonal MIG, use the google_compute_per_instance_config
resource.
To learn how to apply or remove a Terraform configuration, see Basic Terraform commands.
RESTTo create one or multiple instances in a MIG, set custom instance names, and assign predefined static IP addresses to these instances, use the instanceGroupManagers.createInstances
or regionInstanceGroupManagers.createInstances
method.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/createInstances { "instances": [ { "name": "INSTANCE_NAME", "preservedState" : { "internalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, "externalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, ... } }, ... ] }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.nic0
. If you have multiple network interfaces, you can specify multiple NI_NAMES."projects/example-project/regions/us-east1/addresses/example-ip-name"
. You must and can only set one field at a time, either address
or literal
, when assigning a static IP address."130.211.181.55"
. You must and can only set one field at a time, either address
or literal
, when assigning a static IP address.
DELETE_RULE: (Optional.) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
NEVER
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.ON_PERMANENT_INSTANCE_DELETION
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
Example
You need to add one more VM instance to your proxy server cluster, running on a MIG named proxy-cluster
. You have created a static internal IP address reservation named proxy-node-03-ip
and need to assign it to the new node. You want to keep the IP address reservation even if you decide to delete the node in the future.
Call the regionInstanceGroupManagers.createInstances
method to create an additional instance:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/proxy-cluster/createInstances { "instances": [ { "name": "proxy-node-03", "preservedState" : { "internalIPs": { "nic0" : { "ipAddress": { "address": "projects/example-project/regions/us-east1/addresses/proxy-node-03-ip" }, "autoDelete": "NEVER" } } } } ] }
The method creates an instance named proxy-node-03
, assigns the provided static internal IP address named proxy-node-03-ip
to the instance, and stores stateful configuration for the IP in the corresponding per-instance configuration. Because the autoDelete
field is set to NEVER
, the IP remains reserved if you delete the instance later.
You can set a predefined static IP address or update the stateful IP configuration for a managed instance individually–for example:
For an existing instance without an external IP address, for which you configure an external stateful IP, the MIG adds access configuration to the corresponding network interface with the following default values:
"accessConfigs": [ { "kind": "compute#accessConfig", "name": "External Nat", "natIP": "XX.XX.XX.XX", "networkTier": "PREMIUM", "type": "ONE_TO_ONE_NAT" } ]Note: If you need to promote ephemeral IP addresses to static IP addresses for all instances in an existing MIG, configure the corresponding IP addresses to be stateful for the entire MIG in a stateful policy. The group will then promote the ephemeral IP addresses to static for all instances.
If you need to promote the ephemeral IP address of an individual instance in an existing MIG, specify the literal value of the ephemeral IP address (e.g. "130.211.181.55").
Permissions required for this taskTo perform this task, you must have the following permissions:
instanceGroupManagers.updatePerInstanceConfigs
methodregionInstanceGroupManagers.updatePerInstanceConfigs
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectTo configure a stateful IP address individually for a VM instance in a MIG, add or update stateful IP configuration in the associated per-instance configuration.
If a per-instance configuration doesn't yet exist for the instance, use the gcloud compute instance-groups managed instance-configs create
command with one or multiple of the following flags:
--stateful-internal-ip
to set a static internal IP address of a given network interface.--stateful-external-ip
to set a static external IP address of a given network interface.gcloud compute instance-groups managed instance-configs create INSTANCE_GROUP_NAME \ --instance INSTANCE_NAME \ --stateful-internal-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ --stateful-external-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ [--no-update-instance | --update-instance] [--instance-update-minimal-action MINIMAL_ACTION]
If a per-instance configuration already exists for the instance, use the gcloud compute instance-groups managed instance-configs update
command with one or multiple --stateful-internal-ip
or --stateful-external-ip
flags:
gcloud compute instance-groups managed instance-configs update INSTANCE_GROUP_NAME \ --instance INSTANCE_NAME \ --stateful-internal-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ --stateful-external-ip address=ADDRESS[,interface-name=NI_NAME][,auto-delete=DELETE_RULE] \ [--no-update-instance | --update-instance] [--instance-update-minimal-action MINIMAL_ACTION]
Replace the following:
nic0
is assumed by default. If you've multiple network interfaces, you can specify this flag for each IP in each network interface."projects/example-project/regions/us-east1/addresses/example-ip-name"
."130.211.181.55"
.
DELETE_RULE: (Optional.) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
never
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.on-permanent-instance-deletion
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
--update-instance
: (Optional. Default.) Apply the changes immediately to the instance. If you use the --no-update-instance
flag, the changes remain unapplied and will be applied when you recreate or apply the update to the instance later.
MINIMAL_ACTION: (Optional.) Perform at least the specified action when applying per-instance configuration update to the instance. Must be used together with --update-instance
flag. The value must be one of the following:
none
: No action.refresh
: Apply updates that are possible to apply without stopping the instance.restart
: Stop the instance and then start it again.replace
: Recreate the instance.If omitted, the least disruptive action required by the update is used.
Example
You have a file server instance called file-server
, which is a single instance in a stateful MIG called fs-group
. The group has a corresponding per-instance configuration, where a stateful data disk is configured. The file server has only been accessible internally, but now you have users who need to access it externally through a static IP address. You have reserved the static external IP by creating file-server-ip
address reservation. Now you need to assign this IP to the file server instance.
Run the following command to configure the stateful external IP for the file server instance:
gcloud compute instance-groups managed instance-configs update fs-group \ --instance file-server \ --stateful-external-ip interface-name=nic0,address="projects/example-project/regions/us-east1/addresses/file-server-ip",auto-delete=never \ --update-instance
The command does the following:
file-server
instance:
file-server-ip
address reservation.file-server
instance immediately because the --update-instance
flag is included: refreshes the instance and assigns the static external IP address from file-server-ip
reservation.To configure stateful IPs individually for VM instances in a MIG, add or update the stateful IP configuration in the associated per-instance configurations.
If per-instance configurations don't yet exist for the given instances, use the instanceGroupManagers.updatePerInstanceConfigs
method or regionInstanceGroupManagers.updatePerInstanceConfigs
method with stateful configuration for one or multiple IP addresses:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/updatePerInstanceConfigs { "perInstanceConfigs": [ { "name": "INSTANCE_NAME", "preservedState" : { "internalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, "externalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, ... }, "fingerprint: "FINGERPRINT" }, ... ] }Note: While you can use the
updatePerInstanceConfigs
method for updating existing per-instance configurations, this method fully replaces the specified per-instance configurations with new values. We recommend you use the patchPerInstanceConfigs
method to update existing per-instance configurations, as patching keeps the omitted configuration unchanged and prevents the risk of accidental deletion of stateful items or reset of any values to defaults.
If per-instance configurations already exist for the given instances, use the instanceGroupManagers.patchPerInstanceConfigs
method or regionInstanceGroupManagers.patchPerInstanceConfigs
method with stateful configuration for one or multiple IP addresses:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/patchPerInstanceConfigs { "perInstanceConfigs": [ { "name": "INSTANCE_NAME", "preservedState" : { "internalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, "externalIPs": { "NI_NAME" : { "ipAddress": { "address": "ADDRESS", "literal": "LITERAL" }, "autoDelete": "DELETE_RULE" }, ... }, ... }, "fingerprint: "FINGERPRINT" }, ... ] }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.nic0
. If you have multiple network interfaces, you can specify multiple NI_NAMES."projects/example-project/regions/us-east1/addresses/example-ip-name"
. You must and can only set one field at a time, either address or literal, when assigning a static IP address."130.211.181.55"
. You must and can only set one field at a time, either address or literal, when assigning a static IP address.
DELETE_RULE: (Optional.) Prescribes what should happen to an associated static Address resource when a VM instance is permanently deleted. The available options are as follows:
NEVER
: (Default.) Never delete the static IP address. Instead, unassign the address on instance deletion and keep the address reserved.ON_PERMANENT_INSTANCE_DELETION
: Delete the static IP address reservation when an instance is permanently deleted from the instance group–for example, when you delete an instance manually or decrease the group's size.Regardless of the value of the delete rule, the group always preserves stateful IP addresses on instance autohealing, update, and recreation operations.
FINGERPRINT: (Optional.) The fingerprint for the given configuration if it already exists. Used for optimistic locking. The operation fails if the fingerprint is different than provided, as it indicates that the per-instance configuration was changed since it was last read. To see the latest fingerprint, see the output of the listPerInstanceConfigs
method for a regional or zonal MIG. If fingerprint
is omitted, the operation proceeds without fingerprint comparison.
The updatePerInstanceConfigs
and patchPerInstanceConfigs
methods update the specified per-instance configurations but don't apply the configuration updates to the associated managed instances. The changes are applied to an instance when the MIG is instructed to recreate or update the instance. You can apply the update manually to apply the changes to an instance.
Example
You have a file server instance called file-server
, which is a single instance in a stateful MIG called fs-group
. The group has a corresponding per-instance configuration, where a stateful data disk is configured. The file server has only been accessible internally, but now you have users who need to access it externally through a static IP address. You have reserved the static external IP by creating file-server-ip
address reservation. Now you need to assign this IP to the file server instance.
To update the per-instance configuration for file-server
with the new stateful external IP, call the patchPerInstanceConfigs
method:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/fs-group/patchPerInstanceConfigs { "perInstanceConfigs": [ { "name": "file-server", "preservedState" : { "externalIPs": { "nic0" : { "ipAddress": { "address": "projects/example-project/regions/us-east1/addresses/file-server-ip" }, "autoDelete": "NEVER" } } } } ] }
The method patches the per-instance configuration for file-server
instance:
file-server-ip
address reservation.The configuration update is not yet applied to the file-server
VM instance. The MIG will apply the configuration update when you recreate or apply the update to the instance later.
To apply the per-instance configuration update to file-server
VM instance, call the regionInstanceGroupManagers.applyUpdatesToInstances
method for the instance:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/gs-group/applyUpdatesToInstances { "instances": ["/zones/us-east1-b/instances/file-server"] }
The method assigns the configured static external IP address from file-server-ip
reservation to the managed instance. The method refreshes the file-server
instance to assign an external IP address.
Because autoDelete
is set to NEVER
in the stateful IP configuration, the IP will remain reserved if you delete the instance later.
You might need to disassociate a static IP address from an existing VM, making the network interface ephemeral for the VM. This is useful in the following scenarios:
You can disassociate a static IP address from an existing VM in MIG and make the IP address ephemeral for an individual VM by removing the IP's stateful configuration from the associated per-instance configuration or deleting the entire per-instance configuration if it doesn't contain any other state. Applying the change has the following effects:
Removing a stateful IP configuration from a per-instance configuration does not disrupt running VM instances, unless you explicitly choose to do so.
To learn more, see the following documents:
To perform this task, you must have the following permissions:
instanceGroupManagers.patchPerInstanceConfigs
methodregionInstanceGroupManagers.patchPerInstanceConfigs
methodA MIG uses the Google APIs Service Agent service account to manage its instances. This service account has Editor role by default, which includes all necessary permissions for managing stateful IP addresses.
If you need to create a custom role, the following permissions are required for managing stateful network interfaces:
compute.addresses.create
for creating static external IP addressescompute.addresses.createInternal
for creating static internal IP addressescompute.addresses.use
for assigning a static external IP address to an instancecompute.addresses.useInternal
for assigning a static internal IP address to an instancecompute.addresses.delete
for deleting static IP addresses on permanent instance deletioncompute.subnetworks.use
for creating static external IP addressescompute.subnetworks.useInternal
for creating static internal IP addressesroles/compute.networkUser
) role to either the whole host project or select subnets of its Shared VPC networks for creating VM instances with static IP addresses in Shared VPC networks or subnets that belong to the host projectTo remove a stateful IP configuration from the associated per-instance configuration, use the gcloud compute instance-groups managed instance-configs update
command with the --remove-stateful-internal-ips
or --remove-stateful-external-ips
flags:
gcloud compute instance-groups managed instance-configs update INSTANCE_GROUP_NAME \ --instance INSTANCE_NAME \ --remove-stateful-internal-ips NI_NAME[,NI_NAME,...] \ --remove-stateful-external-ips NI_NAME[,NI_NAME,...] [--no-update-instance | --update-instance] \ [--instance-update-minimal-action MINIMAL_ACTION]
Replace the following:
nic0
. If you've multiple network interfaces, you can specify multiple NI_NAMES.--update-instance
: (Optional. Default.) Apply the changes immediately to the instance. If you use the --no-update-instance
flag, the changes remain unapplied and will be applied when you recreate or apply the update to the instance later.MINIMAL_ACTION: (Optional.) Perform at least the specified action when applying per-instance configuration update to the instance. This flag can only be used together with --update-instance
flag. The value must be one of the following:
none
: No action.refresh
: Apply updates that are possible to apply without stopping the instance.restart
: Stop the instance and then start it again.replace
: Recreate the instance.If omitted, the least disruptive action required by the update is used.
Example
Your application has been exposed to users through specific published static external IP addresses of the VM instances in a MIG called example-group
. You have rearchitected your service by deploying a load balancer in front of the MIG and routing the traffic to the managed VMs through it. You no longer need to maintain the static external IP addresses and would like to make the external IP addresses of the VMs ephemeral.
To make the stateful external IP addresses of the VMs in a MIG ephemeral, run the following command for each instance, for example, for node-1
:
gcloud compute instance-groups managed instance-configs update example-group \ --instance node-1 \ --remove-stateful-external-ips nic0 \ --update-instance
The command does the following:
nic0
network interface from the per-instance configuration for node-1
.node-1
VM instance immediately because the --update-instance
flag is included. The VM instance is not disrupted and keeps serving from the same IP, which is no longer stateful. The MIG removes the reference to static IP reservation from the managed instance's preservedStateFromConfig
and treats the external IP address as ephemeral. The MIG will auto-assign an external IP on subsequent instance recreation, update, or autohealing events.To remove a stateful IP configuration from the associated per-instance configuration, use the instanceGroupManagers.patchPerInstanceConfigs
method or regionInstanceGroupManagers.patchPerInstanceConfigs
method:
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/instanceGroupManagers/INSTANCE_GROUP_NAME/patchPerInstanceConfigs { "perInstanceConfigs": [ { "name": "INSTANCE_NAME", "preservedState" : { "internalIPs": { "NI_NAME" : null }, "externalIPs": { "NI_NAME" : null } }, "fingerprint: "FINGERPRINT" }, ... ] }
Replace the following:
regions/REGION
with zones/ZONE
and specify the zone where the MIG is located.nic0
. If you have multiple network interfaces, you can specify multiple NI_NAMES.listPerInstanceConfigs
method for a regional or zonal MIG. If fingerprint
is omitted, the operation proceeds without fingerprint comparison.The patchPerInstanceConfigs
method updates the specified per-instance configurations but does not apply the configuration updates to the associated managed instances. The changes are applied to an instance when the MIG is instructed to recreate or update the instance. You can apply the update manually to apply the changes to an instance.
Example
Your application has been exposed to users through specific published static external IP addresses of the VM instances in a MIG called example-group
. You have rearchitected your service by deploying a load balancer in front of the MIG and routing the traffic to the managed VMs through it. You no longer need to maintain the static external IP addresses and would like to make the external IP addresses of the VMs ephemeral.
To make the stateful external IP addresses of the VMs in a MIG ephemeral, run the following method for each instance, for example, for node-1
, and provide null
value to the network interface's stateful configuration:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/example-group/patchPerInstanceConfigs { "perInstanceConfigs": [ { "name": "node-1", "preservedState" : { "externalIPs": { "nic0" : null } } } ] }
The method removes configuration for the stateful IP address within nic0
network interface from the per-instance configuration for node-1
. The configuration update is not yet applied to the node-1
VM instance. The MIG applies the configuration update on the next instance recreation or update.
To apply the per-instance configuration update to the node-1
VM instance, run the regionInstanceGroupManagers.applyUpdatesToInstances
method for the instance:
POST https://compute.googleapis.com/compute/v1/projects/example-project/regions/us-east1/instanceGroupManagers/example-group/applyUpdatesToInstances { "instances": ["/zones/us-east1-c/instances/node-1"] }
The MIG removes the reference to static IP reservation from the preservedStateFromConfig
field for the node-1
instance and treats the IP address as ephemeral. The MIG will auto-assign an external IP on subsequent instance recreation, update, or autohealing events.
After having been unassigned, the original static IP remains reserved. You can release the IP if you no longer need it.
Removing stateful configurationTo remove configuration from a stateful policy for all VMs in a MIG, see the following documents:
To remove configuration from a per-instance configuration for a specific VM in a MIG, see the following documents:
When configuring stateful IP address for managed instances in a group, you can choose whether to release the associated static IP address reservations manually or automatically when an instance is permanently deleted:
autoDelete
parameter to ON_PERMANENT_INSTANCE_DELETION
.autoDelete
parameter to NEVER
. To clean up unused static IP address reservations, for example, in order to avoid unnecessary charges, see the following documents:
If you have instructed the MIG to never delete the associated IP reservations, the static IP addresses remain reserved after the corresponding instances or the MIG ceases to exist.
FeedbackWe want to learn about your use cases, challenges, and feedback about stateful MIGs. You can share your feedback with our team at mig-discuss@google.com.
What's nextExcept 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."],[[["Stateful IP addresses in managed instance groups (MIGs) ensure that both internal and external IPv4 addresses are preserved during VM autohealing, updates, and recreation, either automatically or specifically assigned."],["Stateful configurations can be applied to all VMs in a group, where the MIG manages static IP assignments, or individually to specific VMs, allowing for the assignment of specific static IPs."],["Several configuration methods are available, including the Google Cloud Console, `gcloud` CLI, Terraform, and REST API, each with specific commands and parameters to manage stateful IP settings for new and existing MIGs and VMs."],["Stateful IP configurations can be removed to make IPs ephemeral, but the previously assigned static IPs remain reserved and require manual release unless an auto-delete policy is configured."],["Proper permissions are crucial for managing stateful IP addresses, whether using default or custom roles, and include permissions for creating, using, and deleting addresses, as well as managing subnetworks and network users."]]],[]]
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