限制工作负载的资源用量
本页介绍了如何为 Assured Workloads 文件夹中的不合规资源启用或停用限制。默认情况下,每个文件夹的控制包都会确定支持哪些产品,从而确定可以使用哪些资源。此功能由 gcp.restrictServiceUsage
组织政策限制条件强制执行,该限制条件会在文件夹创建时自动应用于该文件夹。
准备工作
所需 IAM 角色
如需修改资源使用限制,必须使用以下方法之一向调用者授予 Identity and Access Management (IAM) 权限:预定义角色(包含一组更广泛的权限)或自定义角色(限制为必要的最少权限)。
目标工作负载需要具备以下权限:
assuredworkloads.workload.update
orgpolicy.policy.set
以下两个角色包含这些权限:
- Assured Workloads Administrator
(
roles/assuredworkloads.admin
) - Assured Workloads Editor
(
roles/assuredworkloads.editor
)
如需详细了解 Assured Workloads 的角色,请参阅 IAM 角色。
启用资源用量限制
如需为工作负载启用资源用量限制,请运行以下命令: 此命令会根据控制包支持的服务,对 Assured Workloads 文件夹应用限制:
curl -d '{ "restrictionType": "ALLOW_COMPLIANT_RESOURCES" }' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TOKEN " -X POST \
"SERVICE_ENDPOINT /v1/organizations/ORGANIZATION_ID /locations/WORKLOAD_LOCATION /workloads/WORKLOAD_ID :restrictAllowedServices"
将以下占位符值替换为您自己的值:
TOKEN:请求的身份验证令牌,例如:
ya29.a0AfB_byDnQW7A2Vr5...tanw0427
如果您在环境中安装了 Google Cloud SDK 并已完成身份验证,则可以使用
gcloud auth print-access-token
命令:-H "Authorization: Bearer $(gcloud auth print-access-token)" -X POST \
SERVICE_ENDPOINT:所需的服务端点,例如:
https://us-central1-assuredworkloads.googleapis.com
ORGANIZATION_ID:组织的唯一标识符 Google Cloud,例如:
12321311
WORKLOAD_LOCATION:工作负载的位置,例如:
us-central1
WORKLOAD_ID:工作负载的唯一标识符,例如:
00-c25febb1-f3c1-4f19-8965-a25
替换占位符值后,您的请求应类似于以下示例:
curl -d '{ "restrictionType": "ALLOW_COMPLIANT_RESOURCES" }' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ya29.a0AfB_byDnQW7A2Vr5...tanw0427" -X POST \
"https://us-central1-assuredworkloads.googleapis.com/v1/organizations/12321311/locations/us-central1/workloads/00-c25febb1-f3c1-4f19-8965-a25:restrictAllowedServices"
如果成功,则响应将为空。
停用资源用量限制
如需停用工作负载的资源用量限制,请运行以下命令。此命令可有效移除对 Assured Workloads 文件夹的所有服务和资源限制:
curl -d '{ "restrictionType": "ALLOW_ALL_GCP_RESOURCES" }' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer TOKEN " -X POST \
"SERVICE_ENDPOINT /v1/organizations/ORGANIZATION_ID /locations/WORKLOAD_LOCATION /workloads/WORKLOAD_ID :restrictAllowedServices"
将以下占位符值替换为您自己的值:
TOKEN:请求的身份验证令牌,例如:
ya29.a0AfB_byDnQW7A2Vr5...tanw0427
如果您在环境中安装了 Google Cloud SDK 并已完成身份验证,则可以使用
gcloud auth print-access-token
命令:-H "Authorization: Bearer $(gcloud auth print-access-token)" -X POST \
SERVICE_ENDPOINT:所需的服务端点,例如:
https://us-central1-assuredworkloads.googleapis.com
ORGANIZATION_ID:组织的唯一标识符 Google Cloud,例如:
12321311
WORKLOAD_LOCATION:工作负载的位置,例如:
us-central1
WORKLOAD_ID:工作负载的唯一标识符,例如:
00-c25febb1-f3c1-4f19-8965-a25
替换占位符值后,您的请求应类似于以下示例:
curl -d '{ "restrictionType": "ALLOW_ALL_GCP_RESOURCES" }' \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ya29.a0AfB_byDnQW7A2Vr5...tanw0427" -X POST \
"https://us-central1-assuredworkloads.googleapis.com/v1/organizations/12321311/locations/us-central1/workloads/00-c25febb1-f3c1-4f19-8965-a25:restrictAllowedServices"
如果成功,则响应将为空。
支持的产品和不支持的产品
本部分中的表格列出了各种控制包支持和不支持的产品。如果您启用了默认的资源使用限制,则只能使用受支持的产品。如果您停用资源使用限制,则可以使用受支持和不受支持的产品。
FedRAMP 中等风险级别
端点 | 支持的产品 | 不受支持的产品 |
---|---|---|
aiplatform.googleapis.com |
Vertex AI | AI Platform Training and Prediction API |
FedRAMP 高风险级别
端点 | 支持的产品 | 不受支持的产品 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
compute.googleapis.com |
|
|
刑事司法信息服务 (CJIS)
端点 | 支持的产品 | 不受支持的产品 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accesscontextmanager.googleapis.com |
|
|
|||||||||||||
compute.googleapis.com |
|
|
|||||||||||||
cloudkms.googleapis.com |
|
|
影响级别 4 (IL4)
端点 | 支持的产品 | 不受支持的产品 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
compute.googleapis.com |
|
|
||||||||||||||
cloudkms.googleapis.com |
|
|
美国区域和支持
端点 | 支持的产品 | 不受支持的产品 | |||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
accesscontextmanager.googleapis.com |
|
|
|||||||||||||
compute.googleapis.com |
|
|
|||||||||||||
cloudkms.googleapis.com |
|
|
Service 端点
本部分列出在启用资源使用限制后未被屏蔽的 API 端点。
API 名称 | 端点网址 |
---|---|
Access Context Manager API | accesscontextmanager.googleapis.com |
Advisory Notifications API | advisorynotifications.googleapis.com |
Cloud Asset API | cloudasset.googleapis.com |
Cloud Billing API | cloudbilling.googleapis.com |
Cloud Logging API | logging.googleapis.com |
Cloud Monitoring API | monitoring.googleapis.com |
Cloud Resource Manager API | cloudresourcemanager.googleapis.com |
Google Cloud Observability | stackdriver.googleapis.com |
IAM 服务账号凭据 API | iamcredentials.googleapis.com |
Identity and Access Management API | iam.googleapis.com |
Identity Toolkit API | identitytoolkit.googleapis.com |
Network Telemetry API | networktelemetry.googleapis.com |
Organization Policy Service API | orgpolicy.googleapis.com |
Policy Troubleshooter API | policytroubleshooter.googleapis.com |
Security Token Service API | sts.googleapis.com |
Service Consumer Management API | serviceconsumermanagement.googleapis.com |
Service Control | servicecontrol.googleapis.com |
Service Management API | servicemanagement.googleapis.com |
Service Networking API | servicenetworking.googleapis.com |
Service Usage API | serviceusage.googleapis.com |
后续步骤
- 请参阅不支持资源使用限制的服务列表。
- 了解每个控制包支持哪些产品。