创建和管理拦截端点组关联

拦截端点组关联是一种全球性资源,可将使用方的虚拟私有云网络与用于流量检查的拦截端点组相关联。对于需要流量检查的每个 VPC 网络,您都需要创建拦截端点组关联。配置端点组、端点组关联和防火墙规则以重定向流量后,VPC 网络即可进行流量检查。

配置端点组和端点组关联,并配置防火墙规则以重定向要检查的流量后,VPC 网络即可进行流量检查。

本页介绍了如何创建和管理拦截端点组关联。

准备工作

角色

如需创建、查看或删除拦截端点组关联,请让您的管理员向您授予项目的必要 Identity and Access Management (IAM) 角色。如需详细了解如何授予角色,请参阅管理对项目、文件夹和组织的访问权限

如需检查本页上列出的操作的进度,请确保您的用户角色拥有以下 Intercept Endpoint Admin (roles/networksecurity.interceptEndpointAdmin) 角色和权限:

  • networksecurity.interceptEndpointGroupAssociations.create
  • networksecurity.interceptEndpointGroupAssociations.delete
  • networksecurity.interceptEndpointGroupAssociations.update
  • networksecurity.interceptEndpointGroupAssociations.get
  • networksecurity.interceptEndpointGroupAssociations.list
  • networksecurity.interceptEndpointGroups.use
  • compute.networks.use

创建拦截端点组关联

您可以将一个或多个 VPC 网络与单个拦截端点组相关联。

创建和管理拦截端点组部分,您创建了一个拦截端点组来处理拦截的流量。不过,您还必须指定可以检查哪些 VPC 的流量。为此,您需要创建项目级拦截端点组关联。

您必须在与 VPC 网络相同的项目中创建拦截端点组关联。

控制台

  1. 在 Google Cloud 控制台中,前往端点组页面。

    前往“端点组”页面

  2. 点击端点组的名称。

  3. 关联部分中,点击创建

  4. 在“创建关联”窗格中,点击添加端点组关联

  5. 对于项目网络,选择托管拦截部署组的项目和 VPC 网络。

  6. 点击完成

  7. 点击创建

gcloud

如需创建拦截端点组关联,请使用 gcloud network-security intercept-endpoint-group-associations create 命令

gcloud network-security intercept-endpoint-group-associations create ENDPOINT_GROUP_ASSOCIATION_ID \
    --location global \
    --network NETWORK \
    --no-async \
    --intercept-endpoint-group \
        projects/ENDPOINT_GROUP_PROJECT_ID/locations/global/interceptEndpointGroups/ENDPOINT_GROUP_ID

替换以下内容:

  • ENDPOINT_GROUP_ASSOCIATION_ID:拦截端点组关联的 ID。
  • NETWORK:网络的名称。
  • ENDPOINT_GROUP_PROJECT_ID:您在其中创建了拦截端点组的Google Cloud 项目的 ID。
  • ENDPOINT_GROUP_ID:拦截端点组的 ID。

Terraform

如需创建拦截端点组关联,您可以使用 google_network_security_intercept_endpoint_group_association 资源

resource "google_network_security_intercept_endpoint_group_association" "default" {
  intercept_endpoint_group_association_id = "intercept-endpoint-group-association"
  location                                = "global"
  network                                 = google_compute_network.consumer_network.id
  intercept_endpoint_group                = google_network_security_intercept_endpoint_group.default.id
}

如需了解如何应用或移除 Terraform 配置,请参阅基本 Terraform 命令

查看拦截端点关联的详细信息

您可以查看拦截端点组关联的详细信息,包括其名称、拦截端点组、位置和网络。

您还可以从 VPC 网络详情页面的端点组标签页中查看拦截端点组关联的详细信息。

控制台

  1. 在 Google Cloud 控制台中,前往端点组页面。

    前往“端点组”页面

  2. 点击拦截端点组的名称。关联部分列出了拦截端点关联的详细信息。

gcloud

如需查看拦截端点组关联,请使用 gcloud network-security intercept-endpoint-group-associations describe 命令

gcloud network-security intercept-endpoint-group-associations describe ENDPOINT_GROUP_ASSOCIATION_ID \
    --location global

ENDPOINT_GROUP_ASSOCIATION_ID 替换为拦截端点组关联的 ID。

在输出中,拦截端点关联的名称以 projects/PROJECT_ID/locations/global/interceptEndpointGroupAssociations/ENDPOINT_GROUP_ASSOCIATION_ID 格式显示。

列出拦截端点组关联

您可以列出项目中的所有拦截器端点组关联,包括其 ID。

控制台

  1. 在 Google Cloud 控制台中,前往端点组页面。

    前往“端点组”页面

  2. 点击拦截端点组的名称。关联部分会列出拦截端点组的所有拦截端点关联。

gcloud

如需列出项目中的所有拦截端点组关联,请使用 gcloud network-security intercept-endpoint-group-associations list 命令

gcloud network-security intercept-endpoint-group-associations list

删除拦截端点组关联

您可以删除拦截部署组的拦截端点组关联。

控制台

  1. 在 Google Cloud 控制台中,前往端点组页面。

    前往“端点组”页面

  2. 点击拦截端点组的名称。

  3. 关联部分中,选择要删除的拦截端点关联。

  4. 点击删除

  5. 再次点击删除进行确认。

gcloud

如需删除拦截端点组关联,请使用 gcloud network-security intercept-endpoint-group-associations delete 命令

gcloud network-security intercept-endpoint-group-associations delete ENDPOINT_GROUP_ASSOCIATION_ID \
    --no-async \
    --location global

ENDPOINT_GROUP_ASSOCIATION_ID 替换为拦截端点组关联的 ID。