

文件 AWS 開發套件範例 GitHub 儲存庫中有更多可用的 [AWS SDK 範例](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 ]

**Tools for 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 參考 (V4)》**中的 [DeleteNetworkInterface](https://docs.aws.amazon.com/powershell/v4/reference)。

**Tools for 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 參考 (V5)》**中的 [DeleteNetworkInterface](https://docs.aws.amazon.com/powershell/v5/reference)。

------