> 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（キー管理サービス）サポート

EC2 インスタンスの暗号化に AWS Customer Managed Keys (CMK) を使用する場合、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 キーの詳細。](/files/4fb097e95816764f0cdf2781322b3773dd2eb4f2)

### JSON ポリシー <a href="#verification" id="verification"></a>

または、KMS キーを infrastructure as code で管理している場合は、EBS 暗号化に使用されるキーの JSON ポリシーに以下のステートメントを追加し、 `arn:aws:iam::112233445566:role/aikido-security-ec2` を Aikido VM スキャンロールの ARN に置き換えてください：

```json
{
  "Sid": "Allow use of the key",
  "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": "Allow attachment of persistent resources",
  "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 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/aws/aws-ec2-kms-key-management-service-support.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.
