> 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-vm-scanning/gcp-virtual-machine-scanning-configuration.md).

# Google Cloud 仮想マシンスキャンのセットアップ

{% hint style="info" %}
GCP 仮想マシンスキャンは現在、リクエストに応じてご利用いただけます。 [サポートにお問い合わせください](https://www.aikido.dev/contact) ワークスペースで有効にするには。
{% endhint %}

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

仮想マシンスキャンでは、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="/files/8a607d08827b8dfe91d4c97b6e2250de255925ec" 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 は、セットアップウィザードで 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-vm-scanning/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.
