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 VMs.
You cannot, however, detach the primary network interface from a VM.
Unlinking a NIC from a VM Using Cockpit v2
-
In the NICs dashboard, check the box of the NIC you want to unlink from a VM.
The NIC is selected. -
Click Unlink VM.
A confirmation dialog box appears. -
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.
$ 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.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Unlinking a NIC from a VM Using oapi-cli
The UnlinkNic command detaches a network interface card (NIC) from a virtual machine (VM).
The primary NIC cannot be detached.
$ oapi-cli --profile "default" UnlinkNic \
--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.-
RequestId
: The ID of the request.
-
{
"ResponseContext": {
"RequestId": "0475ca1e-d0c5-441d-712a-da55a4175157"
}
}
Detaching an FNI from an Instance Using AWS CLI
Before you begin: Install and configure AWS CLI. For more information, see Installing and Configuring AWS CLI. |
To detach an FNI from an instance, use the detach-network-interface command following this syntax:
$ 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. For more information, see Installing and Configuring AWS CLI.
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.