将 Compute Engine 与 Google SecOps 集成

本文档介绍了如何将 Compute Engine 与 Google Security Operations 集成。

使用场景

Compute Engine 集成使用 Google SecOps 功能来支持以下用例:

  • 自动化突发事件响应:自动将遭到入侵的 Compute Engine 实例与网络隔离。自动遏制功能可限制攻击的蔓延,缩短响应时间,并减轻安全团队的工作量。

  • 威胁搜寻和调查:自动收集多个项目中 Compute Engine 实例的日志和安全遥测数据。通过分析这些整合的数据,可以主动搜寻威胁,并通过自动收集数据来加快调查速度。

  • 漏洞管理:将漏洞扫描工具与 Google SecOps 集成,以自动扫描 Compute Engine 实例是否存在已知漏洞。直接生成修复工单或修补漏洞,以降低漏洞利用风险并改善安全状况。

  • 合规性自动化:自动从 Compute Engine 实例收集审核日志和配置数据,以符合监管要求。为审计人员生成报告和信息中心,以简化合规性报告并减少人工工作量。

  • 安全编排:跨多个Google Cloud 服务(包括 Compute Engine)编排安全工作流。例如,触发创建新的防火墙规则,以响应在实例上检测到的安全性事件,从而实现更协调、更自动化的安全状况。

准备工作

在 Google SecOps 中配置 Compute Engine 集成之前,请先完成以下前提条件步骤:

  1. 创建和配置自定义 Identity and Access Management 角色。

  2. 创建服务账号。

  3. 选择并配置以下身份验证方法之一:

    • 方法 1:Workload Identity(推荐):此方法使用服务账号模拟来使用短期有效的临时访问令牌。

    • 方法 2:服务账号 JSON 密钥:此方法依赖于静态、长期有效的密钥文件。

创建自定义 IAM 角色

如需为集成提供管理实例所需的特定权限,请创建自定义角色:

  1. 在 Google Cloud 控制台中,前往 IAM 和管理 > 角色。

    打开“角色”

  2. 点击 add 创建自定义角色。

  3. 提供标题(例如 SecOps Compute Engine Integration)、说明和唯一 ID。

  4. 将角色发布阶段设置为正式版。

  5. 点击添加权限,然后添加以下权限:

    • compute.instances.list
    • compute.instances.start
    • compute.instances.stop
    • compute.instances.delete
    • compute.instances.setLabels
    • compute.instances.getIamPolicy
    • compute.instances.setIamPolicy
    • compute.instances.get
    • compute.zones.list
  6. 点击创建。

创建服务账号

  1. 在 Google Cloud 控制台中,前往 IAM 和管理 > 服务账号。

    转到“服务账号”

  2. 点击 add 创建服务账号。

  3. 输入名称和说明,然后点击创建并继续。

  4. 在向此服务账号授予对项目的访问权限步骤中,分配您创建的自定义角色。

  5. 点击完成。记下服务账号电子邮件地址。

配置 Workload Identity 凭证

Workload Identity 是推荐的方法,因为它使用通过服务账号模拟生成的短期有效访问令牌。

识别唯一实例身份

建立连接需要向 Google SecOps 实例授予模拟服务账号的权限。

  1. 在 Google SecOps 中,前往内容中心 > 响应集成。

  2. 选择 Compute Engine 集成,然后在 Workload Identity Email 中输入您的服务账号电子邮件地址。

  3. 依次点击保存 > 测试。测试预计会失败。

  4. 点击测试旁边的 close_small 按钮,然后找到以 gke-init-python@... 或 soar-python@... 开头的身份电子邮件。

  5. 复制此唯一邮箱。

在 Google Cloud中授权实例身份

  1. 在 Google Cloud 控制台中,前往 IAM 和管理 > 服务账号。

    转到“服务账号”

  2. 选择目标服务账号,然后依次前往权限 > 授予访问权限。

  3. 将唯一邮箱粘贴到新的主账号字段中,并分配 Service Account Token Creator 角色 (roles/iam.serviceAccountTokenCreator)。

配置 JSON 密钥

静态、长期有效的密钥文件需要手动轮替。仅当 Workload Identity 身份验证不可用时,才使用此方法。

  1. 在 Google Cloud 控制台中,依次前往 IAM 和管理 > 服务账号,然后选择您的服务账号。

    转到“服务账号”

  2. 前往密钥标签页,然后依次点击添加密钥 > 创建新密钥。

  3. 选择 JSON,然后点击创建。文件会自动下载到您的计算机上。

手动配置各个参数

如果您选择手动输入凭证,请在文本编辑器中打开下载的 JSON 密钥文件,以复制集成设置中所需的各个值。

集成参数

如需在 Google SecOps 与 Compute Engine 之间建立连接,您必须配置以下参数。该集成支持三种不同的身份验证路径。选择以下方法之一来提供凭据:

  • Workload Identity:使用 Workload Identity Email。
  • 服务账号 JSON 文件:使用 Service Account Json File Content 一次性提供整个密钥。
  • 手动输入各个参数:使用从 JSON 密钥中手动复制的单独字段。
参数 说明
API Root

可选。

Compute Engine API 的基础网址。

默认值为 https://compute.googleapis.com。

OS Config API Root

可选。

Cloud OS Config API 的基础网址。

默认值为 https://osconfig.googleapis.com。

Workload Identity Email

可选。

服务账号的客户端邮箱。请将其用于 Workload Identity 身份验证。

Service Account Json File Content

可选。

服务账号密钥 JSON 文件的完整内容。

如果已配置,集成会忽略各个凭据参数。

Project ID

可选。

要定位到的 Google Cloud 项目的 ID。

如果未提供任何值,则集成会从服务账号凭证中检索 ID。

Verify SSL

必填。

验证连接的 SSL 证书。默认处于启用状态。

个人凭证参数

仅当您手动输入凭证(而非使用完整的 JSON 文件内容或 Workload Identity)时,才使用以下参数。

参数 说明
Account Type

可选。

在 JSON 密钥的 type 字段中找到的值(通常为 service_account)。

Private Key ID

可选。

在 JSON 密钥的 private_key_id 字段中找到的值。

Private Key

可选。

在 JSON 密钥的 private_key 字段中找到的值。

Client Email

可选。

在 JSON 密钥的 client_email 字段中找到的值。

Client ID

可选。

在 JSON 密钥的 client_id 字段中找到的值。

Auth URI

可选。

在 JSON 密钥的 auth_uri 字段中找到的值。

默认值为 https://accounts.google.com/o/oauth2/auth。

Token URI

可选。

在 JSON 密钥的 token_uri 字段中找到的值。

默认值为 https://oauth2.googleapis.com/token。

Auth Provider X509 URL

可选。

在 JSON 密钥的 auth_provider_x509_cert_url 字段中找到的值。

Client X509 URL

可选。

在 JSON 密钥的 client_x509_cert_url 字段中找到的值。

如需了解如何在 Google SecOps 中配置集成,请参阅配置集成。

如有需要,您可以在后续阶段进行更改。配置集成实例后,您可以在 playbook 中使用该实例。如需详细了解如何配置和支持多个实例,请参阅支持多个实例。

操作

如需详细了解操作,请参阅 在工作桌上响应待处理的操作和在案例中运行手动操作。

向防火墙规则添加 IP

使用将 IP 范围添加到防火墙规则操作,将 IP 范围附加到 Compute Engine 实例中的现有防火墙规则。

此操作不会在 Google SecOps 实体上运行。

操作输入

Add IP To Firewall Rule 操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /projects/PROJECT_ID/global/ firewallsFIREWALL。

此参数的优先级高于 Project ID 和 Firewall Rule。

Project ID

可选。

与 Compute Engine 实例关联的项目名称。

如果未提供任何值,则该操作会使用集成配置中的项目 ID。

Firewall Rule

可选。

要更新的特定防火墙规则的名称。

Type

必填。

要添加的 IP 范围的流量方向。

可能的值如下:

  • Source
  • Destination

默认值为 Source。

IP Ranges

必填。

要添加到防火墙规则中的 IP 地址范围(CIDR 表示法)的逗号分隔列表。

操作输出

将 IP 添加到防火墙规则操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用将 IP 添加到防火墙规则操作时收到的 JSON 结果输出:

{
  "kind": "compute#operation",
  "id": "0000000000000000000",
  "name": "operation-1716223324528-618e5619d1f93-174eac81-6b38200d",
  "operationType": "patch",
  "targetLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name",
  "targetId": "7886634413370691799",
  "status": "DONE",
  "user": "compute-admin@project-id.",
  "progress": 100,
  "insertTime": "2024-05-20T09:42:05.150-07:00",
  "startTime": "2024-05-20T09:42:05.164-07:00",
  "endTime": "2024-05-20T09:42:09.381-07:00",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/operations/operation-1234567890",
  "firewall": {
    "kind": "compute#firewall",
    "id": "6297155974506248217",
    "creationTimestamp": "2023-09-13T07:28:06.690-07:00",
    "name": "firewall-name",
    "description": "",
    "network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/vpc-network",
    "priority": 1000,
    "sourceRanges": [
      "0.0.0.0/0"
    ],
    "destinationRanges": [
      "0.0.0.0/21"
    ],
    "allowed": [
      {
        "IPProtocol": "tcp",
        "ports": [
          "22"
        ]
      }
    ],
    "direction": "INGRESS",
    "logConfig": {
      "enable": false
    },
    "disabled": false,
    "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name"
  }
}
输出消息

Add IP To Firewall Rule 操作可能会返回以下输出消息:

输出消息 消息说明

Successfully updated firewall rule in Google Cloud Compute.

Waiting for the operation to finish execution on the RESOURCE_PATH instance in Google Cloud Compute.

操作成功。
Error executing action "Add IP To Firewall Rule". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用将 IP 添加到防火墙规则操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

为实例添加标签

使用向实例添加标签操作,在特定 Compute Engine 实例上添加或更新标签。

此操作不会在 Google SecOps 实体上运行。

操作输入

向实例添加标签操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

Compute Engine 实例的唯一 ID。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance Labels

必填。

要应用于实例的逗号分隔列表标签,格式为 key:value(例如 vm_label_key:label1)。

操作输出

向实例添加标签操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用向实例添加标签操作时收到的 JSON 结果输出:

{
   "id": "ID",
   "name": "operation-OPERATION_ID",
   "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
   "operationType": "setLabels",
   "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/instances/INSTANCE_ID",
   "targetId": "INSTANCE_ID",
   "status": "RUNNING",
   "user": "user@example.com",
   "progress": 0,
   "insertTime": "2021-04-28T23:01:29.395-07:00",
   "startTime": "2021-04-28T23:01:29.397-07:00",
   "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/operations/operation-OPERATION_ID",
   "kind": "compute#operation"
}
输出消息

向实例添加标签操作可能会返回以下输出消息:

输出消息 消息说明

Labels LABEL_LIST were successfully added to Compute Engine instance INSTANCE_ID.

Provided instance zone ZONE_ID is not valid.

Provided instance ID is not valid.

Labels were not added because provided label LABEL_ID has the key that already exist for the Compute Engine instance INSTANCE_ID.

操作成功。
Error executing action "Add Labels to Instance". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用向实例添加标签操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

添加网络标记

使用添加网络标记操作可将一个或多个网络标记附加到特定 Compute Engine 实例。

此操作不会在 Google SecOps 实体上运行。

操作输入

添加网络标记操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

Compute Engine 实例的唯一 ID。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Network Tags

必填。

要添加到实例中的网络标记的逗号分隔列表。

所有标签都只能包含小写字母、数字和连字符。

操作输出

添加网络标记操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用添加网络标记操作时收到的 JSON 结果输出:

{
  "kind": "compute#instance",
  "id": "1459671903146615834",
  "creationTimestamp": "2023-09-13T04:20:21.993-07:00",
  "name": "instance-2",
  "description": "",
  "tags": {
    "items": [
      "another-tag",
      "tag"
    ],
    "fingerprint": "BCeEINC7Ths="
  },
  "machineType": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/machineTypes/e2-micro",
  "status": "RUNNING",
  "zone": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a",
  "canIpForward": false,
  "networkInterfaces": [
    {
      "kind": "compute#networkInterface",
      "network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/default",
      "subnetwork": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/subnetworks/default",
      "networkIP": "10.128.0.3",
      "name": "nic0",
      "fingerprint": "-ZnnV7hiDfs=",
      "stackType": "IPV4_ONLY"
    }
  ],
  "disks": [
    {
      "kind": "compute#attachedDisk",
      "type": "PERSISTENT",
      "mode": "READ_WRITE",
      "source": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/disks/instance-2",
      "deviceName": "instance-2",
      "index": 0,
      "boot": true,
      "autoDelete": true,
      "licenses": [
        "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/licenses/centos-7"
      ],
      "interface": "SCSI",
      "guestOsFeatures": [
        { "type": "UEFI_COMPATIBLE" },
        { "type": "GVNIC" }
      ],
      "diskSizeGb": "20",
      "architecture": "X86_64"
    }
  ],
  "metadata": {
    "kind": "compute#metadata",
    "fingerprint": "NBmH4-7Jw9U=",
    "items": []
  },
  "serviceAccounts": [
    {
      "email": "1111111111-compute@",
      "scopes": [
        "https://www.googleapis.com/auth/devstorage.read_only",
        "https://www.googleapis.com/auth/logging.write",
        "https://www.googleapis.com/auth/monitoring.write",
        "https://www.googleapis.com/auth/servicecontrol",
        "https://www.googleapis.com/auth/service.management.readonly",
        "https://www.googleapis.com/auth/trace.append"
      ]
    }
  ],
  "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/instances/instance-2",
  "scheduling": {
    "onHostMaintenance": "MIGRATE",
    "automaticRestart": true,
    "preemptible": false,
    "provisioningModel": "STANDARD"
  },
  "cpuPlatform": "Intel Broadwell",
  "deletionProtection": false,
  "shieldedInstanceConfig": {
    "enableSecureBoot": false,
    "enableVtpm": true,
    "enableIntegrityMonitoring": true
  }
}
输出消息

添加网络标记操作可能会返回以下输出消息:

输出消息 消息说明

Successfully added network tags to the instance RESOURCE_PATH in Compute Engine.

Waiting for the operation to finish execution on the RESOURCE_PATH instance in Compute Engine.

操作成功。
Error executing action "Add Network Tags". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用添加网络标记操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

删除实例

使用删除实例操作可删除 Compute Engine 实例。

此操作不会在 Google SecOps 实体上运行。

操作输入

Delete Instance 操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

操作输出

删除实例操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用删除实例操作时收到的 JSON 结果输出:

{
   "id": "ID",
   "name": "operation-OPERATION_ID",
   "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
   "operationType": "delete",
   "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/instances/INSTANCE_ID",
   "targetId": "INSTANCE_ID",
   "status": "RUNNING",
   "user": "user@example.com",
   "progress": 0,
   "insertTime": "2021-04-28T23:01:29.395-07:00",
   "startTime": "2021-04-28T23:01:29.397-07:00",
   "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/operations/operation-OPERATION_ID",
   "kind": "compute#operation"
}
输出消息

删除实例操作可能会返回以下输出消息:

输出消息 消息说明

Compute Engine instance INSTANCE_ID was deleted successfully.

Provided instance zone ZONE_ID is not valid.

Provided instance ID is not valid.

操作成功。

Error executing action "Start Instance". Reason: ERROR_REASON

Provided resource RESOURCE_PATH is not valid

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用删除实例操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

丰富实体

使用丰富实体操作,通过 Compute Engine 中的实例信息丰富 Google SecOps IP Address 实体。

此操作在以下 Google SecOps 实体上运行:

  • IP Address

操作输入

Enrich Entities 操作需要以下参数:

参数 说明
Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

操作输出

丰富实体操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 可用
丰富化表 可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
案例墙表格

执行完成后,丰富实体操作会提供下表:

表名称:ENTITY 丰富表

列:

  • 实体字段
  • 值
丰富化表

丰富实体操作支持以下实体丰富:

扩充项字段 来源(JSON 密钥) 逻辑
Google_Compute_instance_id id 不可用
Google_Compute_creation_timestamp creationTimestamp 不可用
Google_Compute_instance_name name 不可用
Google_Compute_description description 不可用
Google_Compute_tags tags 以 CSV 列表形式提供标记
Google_Compute_machine_type machineType 不可用
Google_Compute_instance_status status 不可用
Google_Compute_instance_zone zone 不可用
Google_Compute_can_ip_forward canIpForward 不可用
Google_Compute_instance_network_interfaces_name_INDEX networkInterfaces.name 如果有更多可用的网络接口,请展开
Google_Compute_instance_network_interfaces_name_access_configs_type_INDEX networkInterfaces.accessConfigs.type 如果有更多可用的网络接口,请展开
Google_Compute_instance_network_interfaces_name_access_configs_name_INDEX networkInterfaces.accessConfigs.name 如果有更多可用的网络接口,请展开
Google_Compute_instance_network_interfaces_name_access_configs_natIP_INDEX networkInterfaces.accessConfigs.natIP 如果有更多可用的网络接口,请展开
Google_Compute_instance_metadata metadata 实例元数据中的值列表(CSV 格式)
Google_Compute_service_account_INDEX serviceAccounts.email 展开(如果有更多服务账号可用)
Google_Compute_service_account_scopes_INDEX serviceAccounts.scopes 展开(如果有更多服务账号可用)
Google_Compute_link_to_Google_Compute selfLink 不可用
Google_Compute_labels labels 提供 CSV 格式的值列表
Google_Compute_instance_last_start_timestamp lastStartTimestamp 不可用
Google_Compute_instance_last_stop_timestamp lastStopTimestamp 不可用
JSON 结果

以下示例说明了使用丰富实体操作时收到的 JSON 结果输出:

{
    "id": "ID",
    "creationTimestamp": "2021-04-28T21:34:57.369-07:00",
    "name": "instance-1",
    "description": "",
    "tags": {
        "fingerprint": "VALUE"
    },
    "machineType": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/machineTypes/f1-micro",
    "status": "RUNNING",
    "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
    "canIpForward": false,
    "networkInterfaces": [
        {
            "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/default",
            "subnetwork": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/us-central1/subnetworks/default",
            "networkIP": "203.0.113.2",
            "name": "example",
            "accessConfigs": [
                {
                    "type": "ONE_TO_ONE_NAT",
                    "name": "External NAT",
                    "natIP": "198.51.100.59",
                    "networkTier": "PREMIUM",
                    "kind": "compute#accessConfig"
                }
            ],
            "fingerprint": "VALUE",
            "kind": "compute#networkInterface"
        }
    ],
    "disks": [
        {
            "type": "PERSISTENT",
            "mode": "READ_WRITE",
            "source": "https://www.googleapis.com/compute/v1/PROJECT_ID/zones/us-central1-a/disks/instance-1",
            "deviceName": "instance-1",
            "index": 0,
            "boot": true,
            "autoDelete": true,
            "licenses": [
                "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/licenses/LICENSE"
            ],
            "interface": "SCSI",
            "guestOsFeatures": [
                {
                    "type": "UEFI_COMPATIBLE"
                },
                {
                    "type": "VIRTIO_SCSI_MULTIQUEUE"
                }
            ],
            "diskSizeGb": "10",
            "kind": "compute#attachedDisk"
        }
    ],
    "metadata": {
        "fingerprint": "VALUE",
        "kind": "compute#metadata"
    },
    "serviceAccounts": [
        {
            "email": "user@example.com",
            "scopes": [
                "https://www.googleapis.com/auth/devstorage.read_only",
                "https://www.googleapis.com/auth/logging.write",
                "https://www.googleapis.com/auth/monitoring.write",
                "https://www.googleapis.com/auth/servicecontrol",
                "https://www.googleapis.com/auth/service.management.readonly",
                "https://www.googleapis.com/auth/trace.append"
            ]
        }
    ],
    "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/instances/instance-1",
    "scheduling": {
        "onHostMaintenance": "MIGRATE",
        "automaticRestart": true,
        "preemptible": false
    },
    "cpuPlatform": "Intel Haswell",
    "labels": {
        "vm_test_tag": "tag1"
    },
    "labelFingerprint": "VALUE",
    "startRestricted": false,
    "deletionProtection": false,
    "reservationAffinity": {
        "consumeReservationType": "ANY_RESERVATION"
    },
    "displayDevice": {
        "enableDisplay": false
    },
    "shieldedInstanceConfig": {
        "enableSecureBoot": false,
        "enableVtpm": true,
        "enableIntegrityMonitoring": true
    },
    "shieldedInstanceIntegrityPolicy": {
        "updateAutoLearnPolicy": true
    },
    "confidentialInstanceConfig": {
        "enableConfidentialCompute": false
    },
    "fingerprint": "VALUE",
    "lastStartTimestamp": "2021-04-28T21:35:07.865-07:00",
    "kind": "compute#instance"
}
输出消息

Enrich Entities 操作可能会返回以下输出消息:

输出消息 消息说明

Successfully enriched entities: ENTITY_ID.

Provided instance zone ZONE_ID is not valid.

Action was not able to find a match Compute Engine to enrich provided entities: ENTITY_ID.

No entities were enriched.

操作成功。
Error executing action "Enrich Entities". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用丰富实体操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

执行虚拟机修补作业

使用执行虚拟机修补作业操作在 Compute Engine 实例上执行虚拟机修补作业。

此操作不会在 Google SecOps 实体上运行。

操作输入

执行虚拟机修补作业操作需要以下参数:

参数 说明
Instance Filter Object

必填。

用于定位特定实例以进行修补的 JSON 对象。

默认值会定位到所有实例:

{
  "all": "true"
}
    
Name

必填。

修补作业的唯一名称。

Description

可选。

对修补作业用途的简要说明。

Patching Config Object

可选。

一个 JSON 对象,用于定义不同操作系统的具体更新步骤和配置。

如果未提供任何值,则该操作会使用以下默认值:

{
  "rebootConfig": "DEFAULT",
  "apt": {
    "type": "DIST"
  },
  "yum": {
    "security": true
  },
  "zypper": {
    "withUpdate": true
  },
  "windowsUpdate": {
    "classifications": ["CRITICAL", "SECURITY"]
  }
}
    
Patch Duration Timeout

必填。

允许修补作业运行的最长时间(以分钟为单位)。

默认值为 60。

Rollout Strategy

可选。

用于在多个可用区中部署补丁的方法。

可能的值如下:

  • Zone By Zone:一次将补丁应用于一个可用区,以最大限度地降低风险。
  • Concurrent Zones:同时对所有目标可用区应用补丁,以缩短总维护窗口期。

默认值为 Zone By Zone。

Disruption Budget

必填。

可以同时离线的实例数量或百分比(例如 5 或 10%)。

默认值为 10%。

Wait For Completion

必填。

如果选择此选项,则该操作会一直保持有效,直到修补作业完成。

默认处于启用状态。

Fail If Completed With Errors

必填。

如果选择此选项,则当作业状态为 Completed with errors 或达到超时限制时,操作会失败。

如果 Wait For Completion 处于停用状态,系统会忽略此参数。

默认处于启用状态。

操作输出

执行虚拟机修补作业操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用执行虚拟机修补作业操作时收到的 JSON 结果输出:

{
            "name": "projects/PROJECT_ID/patchJobs/JOB_ID",
            "createTime": "2024-09-24T16:00:43.354907Z",
            "updateTime": "2024-09-24T16:00:44.626050Z",
            "state": "PATCHING",
            "patchConfig": {
                "rebootConfig": "DEFAULT",
                "apt": {
                    "type": "UPGRADE"
                },
                "yum": {},
                "zypper": {},
                "windowsUpdate": {}
            },
            "duration": "3600s",
            "instanceDetailsSummary": {
                "startedInstanceCount": "1"
            },
            "percentComplete": 20,
            "instanceFilter": {
                "instances": [
                    "zones/us-central1-a/instances/INSTANCE_ID"
                ]
            },
            "displayName": "test",
            "rollout": {
                "mode": "ZONE_BY_ZONE",
                "disruptionBudget": {
                    "percent": 25
                }
            }
        }
输出消息

执行虚拟机修补作业操作可能会返回以下输出消息:

输出消息 消息说明

Successfully executed VM patching job in Google Cloud Compute.

Successfully executed and completed VM patching job in Google Cloud Compute.

The executed patching job was canceled in Google Cloud Compute.

The executed patching job was completed, but with errors in Compute Engine. Errors: ERROR_DESCRIPTION

操作成功。
Error executing action "Execute VM Patch Job". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用执行虚拟机修补作业操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

获取实例 IAM 政策

使用获取实例 IAM 政策操作可检索特定 Compute Engine 资源的 Identity and Access Management (iam_name_short) 访问权限控制政策。

此操作不会在 Google SecOps 实体上运行。

操作输入

获取实例 IAM 政策操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

操作输出

获取实例 IAM 政策操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用获取实例 IAM 政策操作时收到的 JSON 结果输出:

{
    "version": 1,
    "etag": "BwXBfsc47MI=",
    "bindings": [
        {
            "role": "roles/compute.networkViewer_withcond_2f0c00",
            "members": [
                "user:user@example.com"
            ]
        }
    ]
}
输出消息

获取实例 IAM 政策操作可以返回以下输出消息:

输出消息 消息说明

Compute Engine instance INSTANCE_ID IAM policy was fetched successfully.

Provided instance zone ZONE_ID is not valid.

Provided instance ID is not valid.

操作成功。
Error executing action "Get Instance IAM Policy". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用获取实例 IAM 政策操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

列出实例

使用列出实例操作,根据指定的搜索条件列出 Compute Engine 实例。

此操作不会在 Google SecOps 实体上运行。

操作输入

列出实例操作需要以下参数:

参数 说明
Project ID

可选。

要列出实例的项目的 ID。

如果未提供任何值,该操作会从 Google Cloud 集成配置中使用的服务账号中检索项目 ID。

Instance Zone

可选。

要在其中搜索实例的特定可用区。

如果未提供值,该操作会在所有可用可用区中进行搜索。

Instance Name

可选。

要搜索的实例的名称。

此参数接受以逗号分隔的字符串形式的多个值。

Instance Status

可选。

要包含在搜索结果中的实例的当前状态,例如 RUNNING 或 TERMINATED。

此参数接受以逗号分隔的字符串形式的多个值。

Instance Labels

可选。

用于过滤实例结果的标签,以 key:value 格式(例如 env:production)提供。

此参数接受以逗号分隔的字符串形式的多个值。

Max Rows to Return

可选。

要在结果中返回的实例数上限。

默认值为 50。

操作输出

列出实例操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
案例墙表格

列出实例操作提供下表:

表名称:Compute Engine 实例

表列:

  • 实例名称
  • 实例 ID
  • 实例创建时间
  • 实例说明
  • 实例类型
  • 实例状态
  • 实例标签
JSON 结果

以下示例说明了使用列出实例操作时收到的 JSON 结果输出:

{ "id": "projects/PROJECT_ID/zones/us-central1-a/instances",
   "items": [
       {
           "id": "ID",
           "creationTimestamp": "2021-04-28T21:34:57.369-07:00",
           "name": "instance-1",
           "description": "",
           "tags": {
               "fingerprint": "VALUE"
           },
           "machineType": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/machineTypes/f1-micro",
           "status": "RUNNING",
           "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
           "canIpForward": false,
           "networkInterfaces": [
               {
                   "network": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/default",
                   "subnetwork": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/us-central1/subnetworks/default",
                   "networkIP": "192.0.2.2",
                   "name": "example",
                   "accessConfigs": [
                       {
                           "type": "ONE_TO_ONE_NAT",
                           "name": "External NAT",
                           "natIP": "203.0.113.59",
                           "networkTier": "PREMIUM",
                           "kind": "compute#accessConfig"
                       }
                   ],
                   "fingerprint": "VALUE",
                   "kind": "compute#networkInterface"
               }
           ],
           "disks": [
               {
                   "type": "PERSISTENT",
                   "mode": "READ_WRITE",
                   "source": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/disks/instance-1",
                   "deviceName": "instance-1",
                   "index": 0,
                   "boot": true,
                   "autoDelete": true,
                   "licenses": [
                       "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/licenses/LICENSE"
                   ],
                   "interface": "SCSI",
                   "guestOsFeatures": [
                       {
                           "type": "UEFI_COMPATIBLE"
                       },
                       {
                           "type": "VIRTIO_SCSI_MULTIQUEUE"
                       }
                   ],
                   "diskSizeGb": "10",
                   "kind": "compute#attachedDisk"
               }
           ],
           "metadata": {
               "fingerprint": "VALUE",
               "kind": "compute#metadata"
           },
           "serviceAccounts": [
               {
                   "email": "user@example.com",
                   "scopes": [
                       "https://www.googleapis.com/auth/devstorage.read_only",
                       "https://www.googleapis.com/auth/logging.write",
                       "https://www.googleapis.com/auth/monitoring.write",
                       "https://www.googleapis.com/auth/servicecontrol",
                       "https://www.googleapis.com/auth/service.management.readonly",
                       "https://www.googleapis.com/auth/trace.append"
                   ]
               }
           ],
           "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_IDzones/us-central1-a/instances/instance-1",
           "scheduling": {
               "onHostMaintenance": "MIGRATE",
               "automaticRestart": true,
               "preemptible": false
           },
           "cpuPlatform": "Intel Haswell",
           "labels": {
               "vm_test_tag": "tag1"
           },
           "labelFingerprint": "VALUE",
           "startRestricted": false,
           "deletionProtection": false,
           "reservationAffinity": {
               "consumeReservationType": "ANY_RESERVATION"
           },
           "displayDevice": {
               "enableDisplay": false
           },
           "shieldedInstanceConfig": {
               "enableSecureBoot": false,
               "enableVtpm": true,
               "enableIntegrityMonitoring": true
           },
           "shieldedInstanceIntegrityPolicy": {
               "updateAutoLearnPolicy": true
           },
           "confidentialInstanceConfig": {
               "enableConfidentialCompute": false
           },
           "fingerprint": "VALUE",
           "lastStartTimestamp": "2021-04-28T21:35:07.865-07:00",
           "kind": "compute#instance"
       }
   ]
}
输出消息

列出实例操作可以返回以下输出消息:

输出消息 消息说明

Successfully fetched Compute Engine instances.

Provided instance zone ZONE_ID is not valid.

No instances were found in Compute Engine.

操作成功。
Error executing action "List Instances". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用列出实例操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

Ping

使用 Ping 操作测试与 Compute Engine 的连接。

此操作不会在 Google SecOps 实体上运行。

操作输入

无。

操作输出

Ping 操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 不可用
输出消息 可用
脚本结果 可用
输出消息

Ping 操作可能会返回以下输出消息:

输出消息 消息说明
Successfully connected to the Compute Engine service with the provided connection parameters! 操作成功。
Failed to connect to the Compute Engine service! Error is ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用 Ping 操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

移除外部 IP 地址

使用移除外部 IP 地址操作可移除 Compute Engine 实例上的外部 IP 地址。

此操作不会在 Google SecOps 实体上运行。

操作输入

移除外部 IP 地址操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Network Interfaces

可选。

要修改的特定网络接口的逗号分隔列表。

如果未提供任何值,或者您使用了 * 通配符,则该操作会更新所有网络接口。

默认值为 *。

操作输出

移除外部 IP 地址操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例介绍了使用移除外部 IP 地址操作时收到的 JSON 结果输出:

[
    {
        "endTime": "2024-05-21T04:28:05.371-07:00",
        "id": "ID",
        "insertTime": "2024-05-21T04:28:04.176-07:00",
        "kind": "compute#operation",
        "name": "operation-OPERATION_ID",
        "operationType": "updateNetworkInterface",
        "progress": 100,
        "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-west1-a/operations/operation-OPERATION_ID",
        "startTime": "2024-05-21T04:28:04.190-07:00",
        "status": "DONE",
        "targetId": "TARGET_ID",
        "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-west1-a/instances/INSTANCE_ID",
        "user": "user@example.com",
        "zone": "us-west1-a",
        "networkInterface": "example"
    },
    {
        "endTime": "2024-05-21T04:28:06.549-07:00",
        "id": "2531200345768541098",
        "insertTime": "2024-05-21T04:28:05.419-07:00",
        "kind": "compute#operation",
        "name": "operation-OPERATION_ID",
        "operationType": "deleteAccessConfig",
        "progress": 100,
        "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-west1-a/operations/operation-OPERATION_ID",
        "startTime": "2024-05-21T04:28:05.430-07:00",
        "status": "DONE",
        "targetId": "3905740668247239013",
        "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-west1-a/instances/INSTANCE_ID",
        "user": "user@example.com",
        "zone": "us-west1-a",
        "networkInterface": "example"
    }
]
输出消息

移除外部 IP 地址操作可能会返回以下输出消息:

输出消息 消息说明

Successfully removed external IP addresses from RESOURCE_PATH instance in INTEGRATION_NAME.

Waiting for the operation to finish execution on the RESOURCE_PATH instance in INTEGRATION_NAME.

操作成功。

Error executing action "Remove External IP Addresses". Reason: ERROR_REASON

Action ran into a timeout during execution. Pending operations: PENDING_OPERATIONS. Please increase the timeout in IDE.

The following network interfaces were not found: INTERFACES on the RESOURCE_PATH in INTEGRATION_NAME. Please check the spelling.

Provided instance zone is not valid.

Provided instance ID is not valid.

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用移除外部 IP 地址操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

从防火墙规则中移除 IP

使用从防火墙规则中移除 IP 操作,从现有 Compute Engine 防火墙规则中删除特定 IP 地址范围。

此操作不会在 Google SecOps 实体上运行。

操作输入

从防火墙规则中移除 IP 操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /projects/PROJECT_ID/global/ firewallsFIREWALL。

此参数的优先级高于 Project ID 和 Firewall Rule。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Firewall Rule

可选。

要更新的特定防火墙规则的名称。

Type

必填。

要添加的 IP 范围的流量方向。

可能的值如下:

  • Source
  • Destination

默认值为 Source。

IP Ranges

必填。

要添加到防火墙规则中的 IP 地址范围(CIDR 表示法)的逗号分隔列表。

操作输出

从防火墙规则中移除 IP 操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用从防火墙规则中移除 IP 操作时收到的 JSON 结果输出:

{
  "kind": "compute#operation",
  "id": "9160761312385876914",
  "name": "operation-1716223324528-618e5619d1f93-174eac81-6b38200d",
  "operationType": "patch",
  "targetLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name",
  "targetId": "7886634413370691799",
  "status": "DONE",
  "user": "compute-admin@project-id.",
  "progress": 100,
  "insertTime": "2024-05-20T09:42:05.150-07:00",
  "startTime": "2024-05-20T09:42:05.164-07:00",
  "endTime": "2024-05-20T09:42:09.381-07:00",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/operations/operation-1716223324528-618e5619d1f93-174eac81-6b38200d",
  "firewall": {
    "kind": "compute#firewall",
    "id": "6297155974506248217",
    "creationTimestamp": "2023-09-13T07:28:06.690-07:00",
    "name": "firewall-name",
    "description": "",
    "network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/vpc-network",
    "priority": 1000,
    "sourceRanges": [
      "0.0.0.0/0"
    ],
    "destinationRanges": [
      "0.0.0.0/21"
    ],
    "allowed": [
      {
        "IPProtocol": "tcp",
        "ports": [
          "22"
        ]
      }
    ],
    "direction": "INGRESS",
    "logConfig": {
      "enable": false
    },
    "disabled": false,
    "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name"
  }
}
输出消息

从防火墙规则中移除 IP 操作可能会返回以下输出消息:

输出消息 消息说明

Successfully updated firewall rule in Google Cloud Compute.

Waiting for the operation to finish execution on the RESOURCE_PATH instance in Google Cloud Compute.

操作成功。
Error executing action "Remove IP From Firewall Rule". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用从防火墙规则中移除 IP 操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

移除网络标记

使用移除网络标记操作从 Compute Engine 实例中移除网络标记。

此操作不会在 Google SecOps 实体上运行。

操作输入

移除网络标记操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Network Tags

必填。

要添加到实例中的网络标记的逗号分隔列表。

所有标签都只能包含小写字母、数字和连字符。

操作输出

移除网络标记操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例展示了使用示例操作时收到的 JSON 结果输出:

{
  "kind": "compute#instance",
  "id": "1459671903146615834",
  "creationTimestamp": "2023-09-13T04:20:21.993-07:00",
  "name": "instance-2",
  "description": "",
  "tags": {
    "items": [
      "another-tag",
      "tag"
    ],
    "fingerprint": "BCeEINC7Ths="
  },
  "machineType": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/machineTypes/e2-micro",
  "status": "RUNNING",
  "zone": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a",
  "canIpForward": false,
  "networkInterfaces": [
    {
      "kind": "compute#networkInterface",
      "network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/default",
      "subnetwork": "https://www.googleapis.com/compute/v1/projects/project-id/regions/us-central1/subnetworks/default",
      "networkIP": "10.128.0.3",
      "name": "nic0",
      "fingerprint": "-ZnnV7hiDfs=",
      "stackType": "IPV4_ONLY"
    }
  ],
  "disks": [
    {
      "kind": "compute#attachedDisk",
      "type": "PERSISTENT",
      "mode": "READ_WRITE",
      "source": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/disks/instance-2",
      "deviceName": "instance-2",
      "index": 0,
      "boot": true,
      "autoDelete": true,
      "licenses": [
        "https://www.googleapis.com/compute/v1/projects/centos-cloud/global/licenses/centos-7"
      ],
      "interface": "SCSI",
      "guestOsFeatures": [
        {
          "type": "UEFI_COMPATIBLE"
        },
        {
          "type": "GVNIC"
        }
      ],
      "diskSizeGb": "20",
      "architecture": "X86_64"
    }
  ],
  "metadata": {
    "kind": "compute#metadata",
    "fingerprint": "NBmH4-7Jw9U=",
    "items": []
  },
  "serviceAccounts": [
    {
      "email": "1111111111-compute@",
      "scopes": [
        "https://www.googleapis.com/auth/devstorage.read_only",
        "https://www.googleapis.com/auth/logging.write",
        "https://www.googleapis.com/auth/monitoring.write",
        "https://www.googleapis.com/auth/servicecontrol",
        "https://www.googleapis.com/auth/service.management.readonly",
        "https://www.googleapis.com/auth/trace.append"
      ]
    }
  ],
  "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/zones/us-central1-a/instances/instance-2",
  "scheduling": {
    "onHostMaintenance": "MIGRATE",
    "automaticRestart": true,
    "preemptible": false,
    "provisioningModel": "STANDARD"
  },
  "cpuPlatform": "Intel Broadwell",
  "deletionProtection": false,
  "shieldedInstanceConfig": {
    "enableSecureBoot": false,
    "enableVtpm": true,
    "enableIntegrityMonitoring": true
  }
}
输出消息

移除网络标记操作可能会返回以下输出消息:

输出消息 消息说明

Successfully removed network tags from the instance RESOURCE_PATH in Compute Engine.

Waiting for the operation to finish execution on the RESOURCE_PATH instance in Compute Engine.

操作成功。
Error executing action "Remove Network Tags". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用移除网络标记操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

设置实例 IAM 政策

使用设置实例 IAM 政策操作为指定资源设置访问权限控制政策。您在操作中提供的政策会替换任何现有政策。

此操作不会在 Google SecOps 实体上运行。

操作输入

设置实例 IAM 政策操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Policy

必填。

要应用于实例的 IAM 政策文档,以 JSON 对象的形式提供。

操作输出

设置实例 IAM 政策操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用设置实例 IAM 政策操作时收到的 JSON 结果输出:

{
    "version": 1,
    "etag": "BwXBftu99FE=",
    "bindings": [
        {
            "role": "roles/compute.networkViewer",
            "members": [
                "user:user@example.com"
            ]
        }
    ]
}
输出消息

设置实例 IAM 政策操作可能会返回以下输出消息:

输出消息 消息说明

Successfully set new IAM policy for the Compute Engine instance INSTANCE_ID.

Provided instance zone ZONE_ID is not valid.

Provided instance ID INSTANCE_ID is not valid.

Provided policy JSON document POLICY is not valid.

操作成功。
Error executing action "Set Instance IAM Policy". Reason: ERROR_REASON

Provided resource RESOURCE is not valid.

Error executing action "Set Instance IAM Policy". Reason: "Resource Name" or "Instance Zone" and "Instance ID" needs to be provided.

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用设置实例 IAM 政策操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

启动实例

使用启动实例操作可启动处于已停止或已终止状态的 Compute Engine 实例。

此操作不会在 Google SecOps 实体上运行。

操作输入

启动实例操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

操作输出

启动实例操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用启动实例操作时收到的 JSON 结果输出:

{
   "id": "ID",
   "name": "operation-OPERATION_ID",
   "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
   "operationType": "start",
   "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/instances/INSTANCE_ID",
   "targetId": "INSTANCE_ID",
   "status": "DONE",
   "user": "user@example.com",
   "progress": 100,
   "insertTime": "2021-04-28T23:01:29.395-07:00",
   "startTime": "2021-04-28T23:01:29.397-07:00",
   "endTime": "2021-04-28T23:01:29.397-07:00",
   "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/operations/operation-OPERATION_ID",
   "kind": "compute#operation"
}
输出消息

启动实例操作可能会返回以下输出消息:

输出消息 消息说明

Compute Engine instance RESOURCE_PATH was started successfully.

Provided instance zone ZONE_ID is not valid.

Provided instance ID is not valid.

操作成功。

Error executing action "Start Instance". Reason: ERROR_REASON

Error executing action "Start Instance". Reason: You should provide either "Resource name" or "Instance Zone" and "Instance ID" parameters.

Error executing action "Start Instance". Reason: Given resource name string does not match expected pattern.

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用启动实例操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

停止实例

使用停止实例操作可关停正在运行的 Compute Engine 实例。您可以随时重启已停止的实例。

停止实例会停止虚拟机使用费,但除非删除关联的资源(例如永久性磁盘和静态 IP 地址),否则这些资源仍会继续产生费用。

此操作不会在 Google SecOps 实体上运行。

操作输入

停止实例操作需要以下参数:

参数 说明
Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /project/PROJECT_ID/zone/ ZONE_ID/instances/ INSTANCE_ID。

此参数的优先级高于 Project ID、Instance Zone 和 Instance ID。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Instance Zone

可选。

实例所在的特定可用区。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

Instance ID

可选。

要启动的实例的唯一 ID。

您可以使用列出实例操作检索此值。

如果您使用 Instance Zone 和 Instance ID 标识实例,则此参数是必需的。

操作输出

停止实例操作会提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例说明了使用停止实例操作时收到的 JSON 结果输出:

{
   "id": "ID",
   "name": "operation-OPERATION_ID",
   "zone": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a",
   "operationType": "stop",
   "targetLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/instances/INSTANCE_ID",
   "targetId": "INSTANCE_ID",
   "status": "RUNNING",
   "user": "user@example.com",
   "progress": 100,
   "insertTime": "2021-04-28T23:01:29.395-07:00",
   "startTime": "2021-04-28T23:01:29.397-07:00",
   "selfLink": "https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/us-central1-a/operations/operation-OPERATION_ID",
   "kind": "compute#operation"
}
输出消息

Stop Instance 操作可能会返回以下输出消息:

输出消息 消息说明

Compute Engine instance INSTANCE_ID was stopped successfully.

Provided instance zone ZONE_ID is not valid.

Provided instance ID is not valid.

操作成功。
Error executing action "Stop Instance". Reason: ERROR_REASON

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用停止实例操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

更新防火墙规则

使用更新防火墙规则操作可修改现有 Compute Engine 防火墙规则的配置。此操作可让您更新特定参数,同时保持规则的身份。

此操作不会在 Google SecOps 实体上运行。

操作输入

更新防火墙规则操作需要以下参数:

参数 说明
Firewall Rule

可选。

要更新的特定防火墙规则的名称。

Project ID

可选。

与 Compute Engine 实例关联的项目的 ID。

如果未提供任何值,该操作会从集成配置中检索项目 ID。

Resource Name

可选。

Compute Engine 实例的完整资源名称,格式为 /projects/PROJECT_ID/global/ firewallsFIREWALL。

此参数的优先级高于 Project ID 和 Firewall Rule。

Source IP Ranges

可选。

防火墙规则的来源 IP 地址范围的逗号分隔列表。

如果设置了 none 值,该操作会从规则中删除所有现有来源 IP 范围。

如果未提供任何值,则现有值保持不变。

Source Tags

可选。

要应用于规则的来源网络标记的逗号分隔列表。

如果设置了 none 值,则该操作会从规则中删除所有现有来源标记。

如果未提供任何值,则现有值保持不变。

Source Service Accounts

可选。

要应用于规则的源服务账号的英文逗号分隔列表。

如果设置了 none 值,该操作会从规则中删除所有现有来源服务账号。

如果未提供任何值,则现有值保持不变。

TCP Ports

可选。

要允许或拒绝的 TCP 端口或端口范围的逗号分隔列表。

此参数支持 all 和 none 值。如果已配置,该操作会使用此值更新防火墙规则的协议和端口列表。

UDP Ports

可选。

要允许或拒绝的 UDP 端口或端口范围的逗号分隔列表。

此参数支持 all 和 none 值。如果已配置,该操作会使用此值更新防火墙规则的协议和端口列表。

Other Protocols

可选。

要包含在规则中的 TCP 和 UDP 以外的协议的逗号分隔列表。

如果设置了 none 值,该操作会使用此值更新防火墙规则的协议列表。

Destination IP Ranges

可选。

防火墙规则的目标 IP 地址范围的英文逗号分隔列表。

如果设置了 none 值,该操作会从规则中删除所有现有目标 IP 范围。

如果未提供任何值,则现有值保持不变。

操作输出

更新防火墙规则操作提供以下输出:

操作输出类型 可用性
案例墙附件 不可用
案例墙链接 不可用
案例墙表格 不可用
丰富化表 不可用
JSON 结果 可用
输出消息 可用
脚本结果 可用
JSON 结果

以下示例介绍了使用更新防火墙规则操作时收到的 JSON 结果输出:

{
  "kind": "compute#operation",
  "id": "9160761312385876914",
  "name": "operation-1716223324528-618e5619d1f93-174eac81-6b38200d",
  "operationType": "patch",
  "targetLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name",
  "targetId": "7886634413370691799",
  "status": "DONE",
  "user": "compute-admin@project-id.",
  "progress": 100,g
  "insertTime": "2024-05-20T09:42:05.150-07:00",
  "startTime": "2024-05-20T09:42:05.164-07:00",
  "endTime": "2024-05-20T09:42:09.381-07:00",
  "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/operations/operation-1716223324528-618e5619d1f93-174eac81-6b38200d",
  "firewall": {
    "kind": "compute#firewall",
    "id": "6297155974506248217",
    "creationTimestamp": "2023-09-13T07:28:06.690-07:00",
    "name": "firewall-name",
    "description": "",
    "network": "https://www.googleapis.com/compute/v1/projects/project-id/global/networks/vpc-network",
    "priority": 1000,
    "sourceRanges": [
      "0.0.0.0/0"
    ],
    "destinationRanges": [
      "0.0.0.0/21"
    ],
    "allowed": [
      {
        "IPProtocol": "tcp",
        "ports": [
          "22"
        ]
      }
    ],
    "direction": "INGRESS",
    "logConfig": {
      "enable": false
    },
    "disabled": false,
    "selfLink": "https://www.googleapis.com/compute/v1/projects/project-id/global/firewalls/firewall-name"
  }
}
输出消息

更新防火墙规则操作可能会返回以下输出消息:

输出消息 消息说明
Successfully updated firewall rule in Cloud Compute.

Updating firewall rule in Cloud Compute.

操作成功。
Error executing action "Update Firewall Rule". Reason: ERROR_REASON

Provided firewall name is not valid.

Action ran into a timeout during execution. Please increase the timeout in IDE.

You must provide at least some parameter to update the firewall rule with.

操作失败。

请检查与服务器的连接、输入参数或凭证。

脚本结果

下表列出了使用更新防火墙规则操作时脚本结果输出的值:

脚本结果名称 值
is_success true 或 false

需要更多帮助?获得社区成员和 Google SecOps 专业人士的解答。