

文档 AWS SDK 示例 GitHub 存储库中还有更多 [S AWS DK 示例](https://github.com/awsdocs/aws-doc-sdk-examples)。

本文属于机器翻译版本。若本译文内容与英语原文存在差异，则一律以英文原文为准。

# 将 `DeleteNetworkInterface` 与 CLI 配合使用
<a name="ec2_example_ec2_DeleteNetworkInterface_section"></a>

以下代码示例演示如何使用 `DeleteNetworkInterface`。

------
#### [ CLI ]

**AWS CLI**  
**删除网络接口**  
此示例删除指定的网络接口。如果命令成功，则不返回任何输出。  
命令:  

```
aws ec2 delete-network-interface --network-interface-id eni-e5aa89a3
```
+  有关 API 的详细信息，请参阅*AWS CLI 命令参考[DeleteNetworkInterface](https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/delete-network-interface.html)*中的。

------
#### [ PowerShell ]

**适用于 PowerShell V4 的工具**  
**示例 1：此示例删除指定的网络接口。除非您还指定了 Force 参数，否则在操作继续之前，系统会提示您进行确认。**  

```
Remove-EC2NetworkInterface -NetworkInterfaceId eni-12345678
```
**输出**：  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2NetworkInterface (DeleteNetworkInterface)" on Target "eni-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 4) [DeleteNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)中的。

**适用于 PowerShell V5 的工具**  
**示例 1：此示例删除指定的网络接口。除非您还指定了 Force 参数，否则在操作继续之前，系统会提示您进行确认。**  

```
Remove-EC2NetworkInterface -NetworkInterfaceId eni-12345678
```
**输出**：  

```
Confirm
Are you sure you want to perform this action?
Performing operation "Remove-EC2NetworkInterface (DeleteNetworkInterface)" on Target "eni-12345678".
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "Y"):
```
+  有关 API 的详细信息，请参阅 *AWS Tools for PowerShell Cmdlet 参考 (V* 5) [DeleteNetworkInterface](https://docs.aws.amazon.com/powershell/v5/reference)中的。

------