Detaching a NIC from a VM

You can detach a network interface card (NIC) from a virtual machine (VM) it is attached to, at any time. Network traffic directed to this NIC stops being directed to the VM once the NIC is detached.

This action updates the state of the NIC from in-use to available. For more information, see About NICs > NICs Attachment to Instances.

You cannot, however, detach the primary network interface from a VM.

Unlinking a NIC from a VM Using Cockpit v2

  1. Click inside the NICs dashboard to make checkboxes appear.

  2. Check the box of the NIC you want to unlink from a VM.
    The NIC is selected and an action menu appears.

  3. Click IconUnlink Unlink NIC.
    A confirmation dialog box appears.

  4. Click Unlink.
    The NIC is unlinked from the VM.

Unlinking a NIC from a VM Using OSC CLI

The UnlinkNic command detaches a network interface card (NIC) from a virtual machine (VM).
The primary NIC cannot be detached.

Request sample
$ osc-cli api UnlinkNic --profile "default" \
    --LinkNicId "eni-attach-12345678"

This command contains the following attributes that you need to specify:

  • DryRun: (optional) If true, checks whether you have the required permissions to perform the action.

  • LinkNicId: The ID of the attachment operation.

The UnlinkNic command returns the following elements:

  • ResponseContext: Information about the context of the response.

Result sample
{
  "ResponseContext": {
    "RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
  }
}

Detaching an FNI from an Instance Using AWS CLI

To detach an FNI from an instance, use the detach-network-interface command following this syntax:

Request sample
$ aws ec2 detach-network-interface \
  --profile YOUR_PROFILE \
  --attachment-id eni-attach-1234abcd \
  --endpoint https://fcu.eu-west-2.outscale.com

This command contains the following attributes that you need to specify:

  • (optional) profile: The named profile you want to use, created when configuring AWS CLI. For more information, see Installing and Configuring AWS CLI.

  • attachment-id: The ID of the attachment operation.

  • endpoint: The endpoint corresponding to the Region you want to send the request to.

The FNI is detached from the instance.

Related Pages

Corresponding API Methods

AWS™ and Amazon Web Services™ are trademarks of Amazon Technologies, Inc or its affiliates in the United States and/or other countries.