

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

# `AWSConfigRemediation-DetachAndDeleteVirtualPrivateGateway`
<a name="automation-aws-detach-delete-vpg"></a>

 **描述** 

 `AWSConfigRemediation-DetachAndDeleteVirtualPrivateGateway` 运行手册将分离并删除给定的 Amazon Elastic Compute Cloud (Amazon EC2) 虚拟专用网关，该网关附加到通过 Amazon Virtual Private Cloud (Amazon VPC) 创建的虚拟私有云（VPC）。

 [运行此自动化（控制台）](https://console.aws.amazon.com/systems-manager/automation/execute/AWSConfigRemediation-DetachAndDeleteVirtualPrivateGateway) 

**文档类型**

自动化

**所有者**

Amazon

**平台**

Linux、macOS、Windows

**参数**
+ AutomationAssumeRole

  类型：字符串

  描述：（必需）允许 Systems Manager Automation 代表您执行操作的 AWS Identity and Access Management (IAM) 角色的 Amazon 资源名称（ARN）。
+ VpnGatewayId

  类型：字符串

  描述：（必需）要删除的虚拟专用网关的 ID。

**所需的 IAM 权限**

`AutomationAssumeRole` 参数需要执行以下操作才能成功使用运行手册。
+  `ssm:StartAutomationExecution` 
+  `ssm:GetAutomationExecution` 
+  `ec2:DeleteVpnGateway` 
+  `ec2:DetachVpnGateway` 
+  `ec2:DescribeVpnGateways` 

 **文档步骤** 
+  `aws:waitForAwsResourceProperty` - 接受虚拟专用网关的 ID，然后等到虚拟专用网关的状态属性变为 `available` 或超时。
+  `aws:executeAwsApi` - 检索指定的虚拟专用网关配置。
+  `aws:branch`-基于 VpcAttachments .state 参数值的分支。
+  `aws:waitForAwsResourceProperty`-接受虚拟专用网关的 ID，并等待虚拟专用网关的 VpcAttachments .state 属性更改为`attached`或超时。
+  `aws:executeAwsApi` - 接受虚拟专用网关 ID 和 Amazon VPC 的 ID 作为输入，并将虚拟专用网关与 Amazon VPC 分离。
+  `aws:waitForAwsResourceProperty`-接受虚拟专用网关的 ID，并等待虚拟专用网关的 VpcAttachments .state 属性更改为`detached`或超时。
+  `aws:executeAwsApi` - 接受虚拟专用网关的 ID 作为输入并将其删除。
+  `aws:waitForAwsResourceProperty` - 接受虚拟专用网关的 ID 作为输入，并验证是否将其删除。