

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

# 透過閘道路由表控制進入 VPC 的流量
<a name="associate-route-table-gateway"></a>

若要使用閘道路由表控制進入 VPC 的流量，您可以將網際網路閘道或虛擬私有閘道與路由表建立關聯或取消關聯。如需詳細資訊，請參閱[閘道路由表](gateway-route-tables.md)。

**使用主控台將閘道與路由表建立或取消關聯**

1. 在 [https://console.aws.amazon.com/vpc/](https://console.aws.amazon.com/vpc/) 開啟 Amazon VPC 主控台。

1. 在導覽窗格中，選擇 **Route Tables** (路由表)，然後選取路由表。

1. 從 **Edge associations** (邊緣關聯) 標籤，選擇 **Edit edge associations** (編輯邊緣關聯)。

1. 選取或取消選取閘道的核取方塊。

1. 選擇**儲存變更**。

**使用 將閘道與路由表建立關聯 AWS CLI**  
使用 [associate-route-table](https://docs.aws.amazon.com/cli/latest/reference/ec2/associate-route-table.html) 命令。以下範例將指定路由表與網際網路閘道建立關聯。

```
aws ec2 associate-route-table
    --route-table-id {{rtb-01234567890123456}} \
    --gateway-id {{igw-11aa22bb33cc44dd1}}
```

**使用 取消閘道與路由表的關聯 AWS CLI**  
使用 [disassociate-route-table](https://docs.aws.amazon.com/cli/latest/reference/ec2/disassociate-route-table.html) 命令。指定路由表與閘道之間的關聯 ID。

```
aws ec2 disassociate-route-table \
    --association-id {{rtbassoc-0abcdef1234567890}}
```