> 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）サポート

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>

あるいは、Infrastructure as Code で 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 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.
