配置入站和出站政策
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页面介绍如何为 VPC Service Controls 边界配置入站和出站政策。
您可以为现有边界配置入站和出站政策,也可以在创建边界时添加入站和出站政策。
更新服务边界的入站和出站政策
控制台
在 Google Cloud 控制台导航菜单中,点击安全,然后点击 VPC Service Controls。
转到 VPC Service Controls 页面
选择现有的服务边界。
点击修改边界。
在左侧菜单中,点击入站流量政策或出站流量政策。
指定所需的 API 客户端的“来自于”特性和 Google Cloud 资源/服务的“至”特性。
- 如需查看出站规则特性的列表,请参阅出站规则参考。YAML 特性参考文档描述了 Google Cloud 控制台中显示的特性,但 Google Cloud 控制台使用的名称略有不同。
点击保存。
gcloud
要更新边界政策,请运行以下命令之一,并将 variables 替换为适当的值:
gcloud access-context-manager perimeters update PERIMETER_NAME --set-ingress-policies=INGRESS-FILENAME.yaml
gcloud access-context-manager perimeters update PERIMETER_NAME --set-egress-policies=EGRESS-FILENAME.yaml
例如:
gcloud access-context-manager perimeters update my-perimeter --set-ingress-policies=my-ingress-rule.yaml
在创建边界期间设置入站和出站政策
控制台
在 Google Cloud 控制台导航菜单中,点击安全,然后点击 VPC Service Controls。
转到 VPC Service Controls 页面
点击新建边界。
在左侧菜单中,点击入站流量政策或出站流量政策。
点击添加规则。
指定所需的 API 客户端的“来自于”特性和 Google Cloud 资源/服务的“至”特性。
- 如需查看出站规则特性的列表,请参阅出站规则参考。YAML 特性参考文档描述了 Google Cloud 控制台中显示的特性,但 Google Cloud 控制台使用的名称略有不同。
点击创建边界。
gcloud
在创建边界期间运行以下命令以创建入站/出站政策:
gcloud access-context-manager perimeters create PERIMETER_NAME --title=TITLE --ingress-policies=INGRESS-FILENAME.yaml --restricted-services=SERVICE --resources="projects/PROJECT"
gcloud access-context-manager perimeters create PERIMETER_NAME --title=TITLE --egress-policies=-EGRESS-FILENAME.yaml --restricted-services=SERVICE --resources="projects/PROJECT"
例如:
gcloud access-context-manager perimeters create my-perimeter --title=perimeter-for-project-1 --ingress-policies=my-ingress-rule.yaml --restricted-services=storage.googelapis.com --resources="projects/myproject"
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2023-12-08。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]