

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

# 删除过时的 AWS Transit Gateway 安全组规则
<a name="tgw-sg-updates-stale"></a>

过时的安全组规则是指在同一 VPC 或连接到同一中转网关的 VPC 中引用已删除的安全组的规则。系统不会从您的安全组中自动移除过时的安全组规则，您必须手动删除它们。

您可以使用 Amazon VPC 控制台查看和删除某个 VPC 的过时安全组规则。

**查看和删除过时安全组规则**

1. 通过以下网址打开 Amazon VPC 控制台：[https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/)。

1. 在导航窗格中，选择 **Security Groups**（安全组）。

1. 选择 **Actions (操作)**、**Manage stale rules (管理过时规则)**。

1. 对于 **VPC**，请选择具有过时规则的 VPC。

1. 选择**编辑**。

1. 选择您希望删除的规则旁边的 **Delete**（删除）按钮。选择 **Preview changes (预览更改)**，然后选择 **Save rules (保存规则)**。

**使用命令行描述您的过时的安全组规则**
+ [describe-stale-security-groups](https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-stale-security-groups.html) (AWS CLI)
+ [Get-EC2StaleSecurityGroup](https://docs.aws.amazon.com/powershell/latest/reference/items/Get-EC2StaleSecurityGroup.html) (AWS Tools for Windows PowerShell)

找到过时的安全组规则后，您可以使用 [revoke-security-group-ingress](https://docs.aws.amazon.com/cli/latest/reference/ec2/revoke-security-group-ingress.html) 或 [revoke-security-group-egress](https://docs.aws.amazon.com/cli/latest/reference/ec2/revoke-security-group-egress.html) 命令将其删除。