Cloud Asset Inventory は、 Google Cloud アセット メタデータの表示、検索、エクスポート、モニタリング、分析を可能にするグローバル メタデータ インベントリ サービスです。最大 35 日間の作成、更新、削除履歴を保持します。過去 35 日間に変更されていないアセットは、最新のステータスを報告します。
アセットのメタデータは、次の場所から取得できます。
Google Cloud リソース(Compute Engine VM インスタンス、Cloud Storage バケット、App Engine インスタンスなど)。
Google Cloud リソースに設定されたポリシー(IAM ポリシー、組織のポリシー、Access Context Manager ポリシーなど)。
OS Inventory Management のランタイム情報。
アセットを操作する方法は次のとおりです。
特定のプロジェクト、フォルダ、組織内のアセットとその関係を一覧表示し、最大 35 日間のアセット履歴を取得します。
カスタム クエリ言語を使用してリソースとその IAM 許可ポリシーを検索するか、BigQuery SQL でアセットに対してクエリを実行します。
アセット メタデータを BigQuery または Cloud Storage にエクスポートします。
リソースの IAM ポリシーと組織のポリシーを分析し、リソースの有効な IAM ポリシーを表示して、誰が何にアクセスできるかを確認します。
フィードを設定して登録し、アセットの変更をモニタリングします。
アセットから分析情報を生成して、セキュリティ ポスチャーを強化します。
アセットタイプ、アセット名、コンテンツ タイプ
Cloud Asset Inventory には、アセットを操作する複数の方法が用意されています。使用するメソッドと必要なレスポンスの詳細によっては、リクエストでアセットタイプ、アセット名、コンテンツ タイプを指定する必要があります。
アセットタイプ
Cloud Asset Inventory のメソッドの中には、アセットタイプに基づいて結果を返すものがあります。アセットタイプには、 Google Cloud リソースタイプ、ポリシータイプ、OS インベントリのランタイム情報タイプ、関係タイプが含まれます。使用可能なアセットタイプと、それらをサポートする Cloud Asset Inventory メソッドについては、アセットタイプをご覧ください。
アセット名
Cloud Asset Inventory の一部の関数は、アセット名に基づいて結果を返します。アセット名を指定する場合は、完全なリソース名を使用する必要があります。完全なリソース名の一覧については、アセット名をご覧ください。
コンテンツ タイプ
メタデータ コンテンツ タイプを指定して、リソースの追加メタデータをリクエストできます。コンテンツ タイプを指定しないと、アセット名、最終更新日、アセットが属するプロジェクト、フォルダ、組織などの情報が含まれる基本的なレスポンスのみが返されます。
コンテンツ タイプの名前は、Cloud Asset Inventory の操作方法によって異なります。RPC API と REST API の名前は同じです。ただし、gcloud CLI のコンテンツ タイプ名は別のパターンに従います。整合性と説明の容易さのため、このドキュメントの残りの部分では、コンテンツ タイプを RPC 名と REST 名で参照します。
次の表に、コンテンツ タイプとその説明を示します。
| コンテンツ タイプ | 説明 | |
|---|---|---|
| RPC 名と REST 名 | gcloud CLI 名 | |
ACCESS_POLICY |
access-policy |
アセットに設定されている Access Context Manager ポリシー。 |
IAM_POLICY |
iam-policy |
リソースにバインディングされている IAM ポリシー メタデータ。 |
ORG_POLICY |
org-policy |
アセットに設定された組織のポリシーのメタデータ。このコンテンツ タイプは、以前の組織のポリシー v1 を出力します。組織のポリシー v2 の場合は、resource コンテンツ タイプと orgpolicy.googleapis.com/Policy リソースタイプをお試しください。 |
OS_INVENTORY |
os-inventory |
ランタイム OS インベントリ情報。OS インベントリを有効にするには、VM Manager を設定するの関連手順を行います。 |
RELATIONSHIP |
relationship |
Security Command Center Premium ティアまたは Enterprise ティア、または Gemini Cloud Assist へのアクセスが必要です。 多くの Google Cloud アセットは関係によって相互に接続されています。たとえば、コンピューティング インスタンス グループにコンピューティング インスタンスが含まれる場合や、GKE クラスタにノードが含まれる場合があります。 関係データは 2022 年 5 月 30 日から利用可能になります。関係は、ソースアセットの更新とは異なるタイミングで推測される場合があるため、独自の更新タイムスタンプを持つ可能性があります。 サポートされている関係の一覧については、関係タイプをご覧ください。 |
RESOURCE |
resource |
リソースのメタデータ。 |
コンテンツ タイプによって回答がどのように変化するか
次の例は、Cloud Asset Inventory で異なるコンテンツ タイプを使用してプロジェクト内の VM インスタンスを一覧表示した場合のレスポンスの変化を示しています。
コンテンツ タイプなし
VM インスタンスを一覧表示するときにコンテンツ タイプを指定しないと、インスタンス名、最終更新日、インスタンスが属するプロジェクト、フォルダ、組織のみが返されます。
開いてレスポンスの例を表示
--- ancestors: - projects/PROJECT_NUMBER - folders/FOLDER_NUMBER - organizations/ORGANIZATION_ID assetType: compute.googleapis.com/Instance name: //compute.googleapis.com/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME updateTime: '2023-11-15T12:28:30.087825Z'
IAM_POLICY コンテンツ タイプ
IAM_POLICY コンテンツ タイプを指定すると、VM の IAM バインディングも取得されます(存在する場合)。
開いてレスポンスの例を表示
---
ancestors:
- projects/PROJECT_NUMBER
- folders/FOLDER_NUMBER
- organizations/ORGANIZATION_ID
assetType: compute.googleapis.com/Instance
iamPolicy:
bindings:
- members:
- user:USER_EMAIL_ADDRESS
role: roles/compute.securityAdmin
etag: ETAG
name: //compute.googleapis.com/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
updateTime: '2023-12-19T23:35:42.673842Z'RESOURCE コンテンツ タイプ
RESOURCE コンテンツ タイプを指定すると、VM に関連付けられているすべてのメタデータも取得されます。
開いてレスポンスの例を表示
---
ancestors:
- projects/PROJECT_NUMBER
- folders/FOLDER_NUMBER
- organizations/ORGANIZATION_ID
assetType: compute.googleapis.com/Instance
name: //compute.googleapis.com/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
resource:
data:
allocationAffinity:
consumeAllocationType: ANY_ALLOCATION
canIpForward: false
confidentialInstanceConfig:
enableConfidentialCompute: true
cpuPlatform: AMD Rome
creationTimestamp: '2023-11-14T14:35:37.059-08:00'
deletionProtection: false
description: ''
disks:
- architecture: X86_64
autoDelete: true
boot: true
deviceName: INSTANCE_NAME
diskSizeGb: '10'
guestOsFeatures:
- type: VIRTIO_SCSI_MULTIQUEUE
- type: SEV_CAPABLE
- type: SEV_SNP_CAPABLE
- type: SEV_LIVE_MIGRATABLE
- type: UEFI_COMPATIBLE
- type: GVNIC
index: 0
interface: NVME
licenses:
- https://www.googleapis.com/compute/v1/projects/ubuntu-os-cloud/global/licenses/ubuntu-2004-lts
mode: READ_WRITE
shieldedInstanceInitialState:
dbx:
- content: DATA
fileType: BIN
dbxs:
- content: DATA
fileType: BIN
source: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/disks/INSTANCE_NAME
type: PERSISTENT
displayDevice:
enableDisplay: false
fingerprint: FINGERPRINT
id: 'ID'
keyRevocationActionType: NONE_ON_KEY_REVOCATION
labelFingerprint: LABEL_FINGERPRINT
lastStartTimestamp: '2023-11-15T04:28:30.005-08:00'
machineType: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/machineTypes/n2d-standard-2
name: INSTANCE_NAME
networkInterfaces:
- accessConfigs:
- name: External NAT
natIP: 34.27.105.222
networkTier: PREMIUM
type: ONE_TO_ONE_NAT
fingerprint: jKU51FdTluk=
name: nic0
network: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/default
networkIP: 10.128.15.212
nicType: GVNIC
stackType: IPV4_ONLY
subnetwork: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/regions/REGION/subnetworks/default
reservationAffinity:
consumeReservationType: ANY_ALLOCATION
resourceStatus: {}
scheduling:
automaticRestart: true
onHostMaintenance: TERMINATE
preemptible: false
provisioningModel: STANDARD
selfLink: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME
serviceAccounts:
- email: PROJECT_NUMBER-compute@developer.gserviceaccount.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
shieldedInstanceConfig:
enableIntegrityMonitoring: true
enableSecureBoot: false
enableVtpm: true
shieldedInstanceIntegrityPolicy:
updateAutoLearnPolicy: true
startRestricted: false
status: RUNNING
tags:
fingerprint: FINGERPRINT
zone: https://www.googleapis.com/compute/v1/projects/PROJECT_ID/zones/ZONE
discoveryDocumentUri: https://www.googleapis.com/discovery/v1/apis/compute/v1/rest
discoveryName: Instance
location: ZONE
parent: //cloudresourcemanager.googleapis.com/projects/PROJECT_NUMBER
version: v1
updateTime: '2023-11-15T12:28:30.087825Z'RELATIONSHIP コンテンツ タイプ
RELATIONSHIP を使用するには、Security Command Center のPremium ティアもしくは Enterprise ティア、または Gemini Cloud Assist へのアクセス権が必要です。
RELATIONSHIP コンテンツ タイプを指定すると、VM インスタンスの関連アセットに関連付けられたメタデータも取得されます。
開いてレスポンスの例を表示
--- ancestors: - projects/PROJECT_NUMBER - folders/FOLDER_NUMBER - organizations/ORGANIZATION_ID assetType: compute.googleapis.com/Instance name: //compute.googleapis.com/projects/PROJECT_ID/zones/ZONE/instances/INSTANCE_NAME relatedAsset: ancestors: - projects/PROJECT_NUMBER - folders/FOLDER_NUMBER - organizations/ORGANIZATION_ID asset: //compute.googleapis.com/projects/PROJECT_ID/zones/ZONE/disks/INSTANCE_NAME assetType: compute.googleapis.com/Disk relationshipType: COMPUTE_INSTANCE_USE_DISK updateTime: '2023-12-19T23:35:42.673842Z'
RELATIONSHIP コンテンツ タイプを使用する場合は、すべての RELATIONSHIP をリクエストする代わりに、特定の関係タイプをリクエストできます。
データの鮮度
Cloud Asset Inventory は、現在のデータに対して結果整合性を提供し、過去のデータに対してベスト エフォート整合性を提供します。まれに、Cloud Asset Inventory で一部のデータの更新が検出されないことがあります。
リソースタイプの表に記載されていない限り、ほとんどのアセットの更新は数分で利用可能になります。