> 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/aws/aws-ec2-kms-key-management-service-support.md).

# AWS EC2 KMS（Key Management Service）サポート

AWS Customer Managed Keys (CMK) を使用して EC2 インスタンスを暗号化する場合、Aikido のスキャンロールにこれらのキーへのアクセス権を付与する必要があります。このガイドでは、必要な手順を説明します。

## 前提条件 <a href="#prerequisites" id="prerequisites"></a>

* CMK で暗号化された EC2 インスタンスがあります。
* AWS KMS で EBS 暗号化に使用するキーにアクセスできます。
* あなたは [Aikido で EC2 スキャンを有効にしました](/docs/docs-ja/mashinsukyan/aws/aws-ec2-virtual-machine-scanning-setup.md#getting-started). ロール ARN が必要です。

## アクセス権を付与する手順 <a href="#steps-to-grant-access" id="steps-to-grant-access"></a>

1. 次へ移動します: **AWS KMS** → **カスタマー管理キー**
2. EC2 暗号化に使用している CMK を見つけてクリックします
3. キー詳細ページで、次までスクロールします **キーユーザー** セクション
4. クリックします **追加** 新しいキーユーザーを追加する
5. Aikido VM スキャンロールを検索して選択します
6. 変更を保存します

![設定、キーポリシー、および割り当てられたキーユーザーを示す AWS KMS キーの詳細。](https://715870456-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FyKbzcQGrx7UtrG0nPZZ7%2Fuploads%2Fgit-blob-c24968823181b242fad8aa8250cdf66020426f4d%2Faws-ec2-kms-key-management-service-support_45cb385d-1e41-4be6-ba51-43844ec553ad.png?alt=media)

### JSON ポリシー <a href="#json-policy" id="json-policy"></a>

または、インフラストラクチャをコードとして使用して KMS キーを管理している場合は、EBS 暗号化に使用されるキーの JSON ポリシーに以下のステートメントを追加し、 `arn:aws:iam::112233445566:role/aikido-security-ec2` を、Aikido VM スキャンロールの ARN に置き換えます:

```json
{
  "Sid": "キーの使用を許可",
  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:iam::112233445566:role/aikido-security-ec2" // これに置き換える
  },
  "Action": [
    "kms:Encrypt",
    "kms:Decrypt",
    "kms:ReEncrypt*",
    "kms:GenerateDataKey*",
    "kms:DescribeKey"
  ],
  "Resource": "*"
},
{
  "Sid": "永続的リソースのアタッチを許可",
  "Effect": "Allow",
  "Principal": {
    "AWS": "arn:aws:iam::112233445566:role/aikido-security-ec2" // これに置き換える
  },
  "Action": ["kms:CreateGrant", "kms:ListGrants", "kms:RevokeGrant"],
  "Resource": "*",
  "Condition": {
    "Bool": {
      "kms:GrantIsForAWSResource": "true"
    }
  }
}
```

## 検証 <a href="#verification" id="verification"></a>

Aikido ロールをキーユーザーとして追加すると、Aikido は CMK で暗号化された EC2 インスタンスをスキャンできるはずです。

## 重要な注意事項 <a href="#important-notes" id="important-notes"></a>

* これらの権限がないと、Aikido は CMK で暗号化された EC2 インスタンスをスキャンできません。
* この権限は、スキャン目的に必要なアクセスのみを許可するように特に範囲が限定されています。
* 後でこれらの権限を削除すると、スキャン機能に影響します。

## トラブルシューティング <a href="#troubleshooting" id="troubleshooting"></a>

CMK で暗号化されたインスタンスでスキャンの問題が発生する場合は、次を確認してください：

* 正しい CMK が選択されている
* Aikido ロールがキーユーザーとして正しく追加されている
* キーのポリシーが変更され、権限が削除されていない

## どの VM をスキャンするかの管理 <a href="#managing-which-vms-are-scanned" id="managing-which-vms-are-scanned"></a>

Aikido は [VM スキャンの包含/除外モデルをサポートしています](/docs/docs-ja/mashinsukyan/aws/managing-which-vms-are-scanned.md).

## スキャン頻度

毎日、スキャン有効なすべての VM の 10% が再スキャンされるため、平均すると各 VM は 10 日に 1 回スキャンされます。


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.aikido.dev/docs/docs-ja/mashinsukyan/aws/aws-ec2-kms-key-management-service-support.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
