> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/mashinsukyan/gcp-virtual-machine-scanning-configuration.md).

# Google Cloud仮想マシンスキャンの設定

### 仮想マシンをスキャンするべき理由は何ですか？

仮想マシンスキャンでは、Aikido が Google Compute Engine VM のディスクをスキャンし、脆弱なパッケージ、古いランタイム、リスクのあるライセンスを検出します。

### 始め方

Google Cloud インスタンスのスキャンを有効にするには、まず Google Cloud プロジェクトを Aikido に接続する必要があります。記載されている手順に従ってください [こちら](https://help.aikido.dev/cloud-scanning/connect-your-cloud/gcp) まだ完了していない場合。

クラウドを接続したら、［Virtual Machines］ページに移動して、次をクリックします **VM を接続**.

<figure><img src="https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-4ac532a835256cfec595826353989bf595139973%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

の **仮想マシンを接続する** モーダルで、次を選択します **Google Cloud** の下で **エージェントレススキャン**。Aikido が次の4つの手順を案内します：

カスタムロールとサービスアカウントには必要最小限の権限のみが付与され、ストレージ権限はプロジェクト全体ではなくスナップショットバケットのみに限定されます。これにより、Aikido はリソースが意図せず変更されるリスクなく、セキュリティチェックを実行できます。

{% stepper %}
{% step %}
**必要な Google Cloud API を有効にする**

Aikido がコンピューティングインスタンスをスキャンするには、プロジェクトで複数の Google Cloud API を有効にする必要があります。

1. GCP コンソールで、次をクリックします **Cloud Shell を有効にする** 右上にあるアイコン。
2. 画面下部に開くシェルで、セットアップページに表示されているコマンドを実行します。これにより、次の API が有効になります：
   * `compute.googleapis.com`
   * `iam.googleapis.com`
3. コマンドが完了したら、次をクリックします **続行**.
   {% endstep %}

{% step %}
**カスタムロールを作成**

Aikido は2つのカスタムロールを使用します：

1. インスタンスの一覧表示、ディスクの読み取り、スナップショットの作成、およびスナップショットの読み取りを行うメインロール
2. Aikido が作成したスナップショットを削除するための、削除専用ロール

セットアップウィザードに表示されるコマンドを実行して、両方のロールを作成します。

メインロールには次が含まれます：

* `compute.instances.list`
* `compute.instanceGroups.get`
* `compute.instanceGroups.list`
* `compute.disks.createSnapshot`
* `compute.disks.get`
* `compute.snapshots.create`
* `compute.snapshots.get`
* `compute.snapshots.list`
* `compute.snapshots.setLabels`
* `compute.snapshots.useReadOnly`

2つ目のロールには次が含まれます：

* `compute.snapshots.delete`

ロールを作成したら、それらの ID をメモします（`aikidoSecurityVmScannerRole` および `aikidoSecurityVmScannerSnapshotDeleteRole` 変更していない場合）。

押す **続行**.

{% hint style="info" %}
**このロールのすべての権限を保持します。** これは、Aikido が VM スキャンを実行するために必要な絶対的な最小限の権限です。いずれかを削除すると、スキャンは失敗します。
{% endhint %}
{% endstep %}

{% step %}
**アクセスを付与**

Aikido は、セットアップウィザードで管理対象の Google Cloud サービスアカウントのメールアドレスを表示します。手順2で作成したロールを、Aikido 管理のサービスアカウントに付与します：

* ウィザードに表示されるコマンドを使用して、そのサービスアカウントにメインのカスタムロールを付与します。
* 次に、ウィザードに表示される2つ目のコマンドを使用して削除専用ロールを付与します。このバインディングには条件が含まれており、Aikido が作成したスナップショットにのみ適用されます。これにより、Aikido は自ら作成したスナップショットだけを削除できます。
  {% endstep %}
  {% endstepper %}

### 仕組み

大まかなフローは次のとおりです：

{% stepper %}
{% step %}
Aikido は Google Cloud プロジェクト内の GCE インスタンスを検出します。
{% endstep %}

{% step %}
Aikido はプロジェクト内の対応するディスクのスナップショットを作成します。

{% hint style="info" %}
Aikido はそれらのスナップショットにラベルを付け、付与した削除権限が Aikido 管理のスナップショットにのみ適用されるようにします。
{% endhint %}
{% endstep %}

{% step %}
次に Aikido は、各スナップショットから Aikido 管理プロジェクト内に一時ディスクを作成します。

{% hint style="info" %}
ディスクは、元のディスクと同じリージョンにある Aikido 管理プロジェクト内で作成・スキャンされます。
{% endhint %}
{% endstep %}

{% step %}
一時ディスクは分離された一時ジョブに接続され、そこで実際のスキャンが実行されます。
{% endstep %}

{% step %}
一時ディスクは Aikido 管理プロジェクトから削除されます。
{% endstep %}
{% endstepper %}

### VPC Service Controls で GCP VM スキャンを使用する

GCP プロジェクトが VPC Service Controls の境界で保護されている場合、説明されている IAM 権限に加えて、プロジェクト間の追加操作を1つ許可する必要がある場合があります [上記](#getting-started).

次で説明しているように [「仕組み」セクション](#how-it-works)、Aikido はプロジェクト内にスナップショットを作成し、そのスナップショットから Aikido のスキャナープロジェクト内に一時ディスクを作成します。ディスクの作成は VPC Service Controls によってブロックされる可能性があります。

**許可する内容**

* サービス： `compute.googleapis.com`
* メソッド： `compute.v1.DisksService.Insert`
* 対象プロジェクト： `aikido-vm-scanning`
* サービスアカウント： `aikido-vm-scanner-batch@aikido-vm-scanning.iam.gserviceaccount.com`

### ドメイン制限付き共有で GCP VM スキャンを使用する

次のような組織ポリシー制約を使用している場合 `iam.managed.allowedPolicyMembers` または `iam.allowedPolicyMemberDomains`の場合、Aikido の Google Workspace カスタマー ID は次のとおりです： `C016qe815`.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/mashinsukyan/gcp-virtual-machine-scanning-configuration.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
