

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 在 中分離和刪除虛擬私有閘道 AWS Site-to-Site VPN
<a name="delete-vgw"></a>

您可以分離不再需要用於 VPC 的虛擬私有閘道。

**使用主控台分離虛擬私有閘道**

1. 在導覽窗格中，選擇**虛擬私有閘道**。

1. 選取虛擬私有閘道，然後選擇 **Actions (動作)**、**Detach from VPC (自 VPC 分離)**。

1. 選擇**分離虛擬私有閘道**。

您可以刪除不再需要的分離虛擬私有閘道。您不能刪除仍然連接至 VPC 的虛擬私有閘道。刪除虛擬私有閘道之後，它會在一段時間內保持顯示並處於 `deleted` 狀態，然後系統會自動移除該項目。

**使用主控台刪除虛擬私有閘道**

1. 在導覽窗格中，選擇**虛擬私有閘道**。

1. 選取虛擬私有閘道，然後選擇**動作**、**刪除虛擬私有閘道**。

1. 出現確認提示時，請輸入 **delete**，然後選擇 **Delete** (刪除)。

**使用命令列或 API 分離虛擬私有閘道**
+ [DetachVpnGateway](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DetachVpnGateway.html) (Amazon EC2 Query API)
+ [detach-vpn-gateway](https://docs.aws.amazon.com/cli/latest/reference/ec2/detach-vpn-gateway.html) (AWS CLI)
+ [Dismount-EC2VpnGateway](https://docs.aws.amazon.com/powershell/latest/reference/items/Dismount-EC2VpnGateway.html) (AWS Tools for Windows PowerShell)

**使用命令列或 API 刪除虛擬私有閘道**
+ [DeleteVpnGateway](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DeleteVpnGateway.html) (Amazon EC2 Query API)
+ [delete-vpn-gateway](https://docs.aws.amazon.com/cli/latest/reference/ec2/delete-vpn-gateway.html) (AWS CLI)
+ [Remove-EC2VpnGateway](https://docs.aws.amazon.com/powershell/latest/reference/items/Remove-EC2VpnGateway.html) (AWS Tools for Windows PowerShell)