Delete Dynamic Network Interfaces from an instance
This page describes how to delete a Dynamic Network Interface (NIC) from an existing Compute Engine instance.
For an overview of multiple network interfaces, see Multiple network interfaces.
To view an instance's existing network interfaces, see View network interfaces for an instance.
Delete a Dynamic NIC from an instance
This section describes how to delete a Dynamic NIC from an instance.
To prevent a possible error when deleting a Dynamic NIC by instance update, don't delete Dynamic NICs from individual instances by updating instance properties.
Console
- In the Google Cloud console, go to the VM instances page. 
- Click the name of the instance for which you want to delete a Dynamic NIC. 
- On the instance details page, click Edit. 
- In the Dynamic Network Interfaces section, locate the Dynamic NIC that you want to delete. 
- To delete the Dynamic NIC, click Delete. 
- To save your configuration, click Save. 
gcloud
To delete a Dynamic NIC from an existing instance, use the instances network-interfaces delete command.
gcloud compute instances network-interfaces delete INSTANCE_NAME \ --zone=ZONE \ --network-interface=DYNAMIC_NIC_NAME
Replace the following:
- INSTANCE_NAME: the name of the instance to create
- ZONE: the zone of the instance
- DYNAMIC_NIC_NAME: the name of the Dynamic NIC to delete, such as- nic0.2
API
To delete a Dynamic NIC from an existing instance, use the instances.deleteNetworkInterface method.
POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME/deleteNetworkInterface?networkInterfaceName=DYNAMIC_NIC_NAME
Replace the following:
- PROJECT_ID: the ID of the project that contains the instance
- ZONE: the zone that contains the instance
- INSTANCE_NAME: the name of the instance to delete the Dynamic NIC from
- DYNAMIC_NIC_NAME: the name of the Dynamic NIC to delete, such as- nic0.2
Delete a Dynamic NIC from instances in a MIG
This section describes how to delete a Dynamic NIC from instances in a MIG by creating a new instance template and applying the configuration to the MIG. Updating an existing instance template is not supported.
For more information about creating instance templates, see Create instance templates. To view an existing instance template, see Get, list, and delete instance templates.
Console
- Go to the Instance templates page. 
- Click the instance template that you want to copy and update. 
- Click Create similar. 
- Expand the Advanced options section, and then expand the Networking section. 
- In the Dynamic Network Interfaces section, locate the Dynamic NIC that you want to delete. 
- To delete the Dynamic NIC, click Delete. 
- To create the instance template, click Create. 
- To update or recreate your instances with the new instance template, see Apply new VM configurations in a MIG. 
gcloud
- To create a new instance template that deletes a Dynamic NIC, use the - gcloud compute instance-templates createcommand.- Include the - --network-interfaceflag for each network interface from your existing instance template, except for the Dynamic NIC that you want to delete.- Adjust the following example to specify network interfaces and other properties as needed. For more examples of how to create instances with multiple network interfaces, see Create VMs with multiple network interfaces. - gcloud compute instance-templates create INSTANCE_TEMPLATE_NAME \ --network-interface=network=NETWORK_A,subnet=SUBNET_A \ [--network-interface=network=NETWORK_B,subnet=SUBNET_B[,vlan=VLAN_ID]] - Replace the following: - INSTANCE_TEMPLATE_NAME: a name for the new instance template.
- NETWORK_A,- NETWORK_B: the network where the interface attaches.
- SUBNET_A,- SUBNET_B: the subnet where the interface attaches.
- VLAN_ID: a VLAN ID. Specifying a VLAN ID configures the network interface as a Dynamic NIC. You must place a Dynamic NIC after its parent vNIC in the command.
 
- To update or recreate your instances with the new instance template, see Apply new VM configurations in a MIG. 
API
- To create a new instance template that deletes a Dynamic NIC, use the - instanceTemplates.insertmethod to create a global instance template or the- regionInstanceTemplates.insertmethod to create a regional instance template.- In the - networkInterfacesfield, include each network interface from your existing instance template, except for the Dynamic NIC that you want to delete.- Adjust the following example to specify network interfaces and other properties as needed. For more examples of how to create instances with multiple network interfaces, see Create VMs with multiple network interfaces. - POST https://compute.googleapis.com/compute/v1/projects/PROJECT_ID/global/instanceTemplates { .... "networkInterfaces": [ { "subnetwork": "regions/REGION/subnetworks/SUBNET_A" }, { "subnetwork": "regions/REGION/subnetworks/SUBNET_B", "vlan": "VLAN_ID" }, additional network interfaces... ], other instance settings... }- Replace the following: - PROJECT_ID: the ID of the project that contains the instance template.
- REGION: the region that contains the instances.
- SUBNET_A,SUBNET_B: the subnet where each network interface is located.
- VLAN_ID: a VLAN ID. Specifying a VLAN ID configures the network interface as a Dynamic NIC. You must place a Dynamic NIC after its parent vNIC the request.
 
- To update or recreate your instances with the new instance template, see Apply new VM configurations in a MIG.