> 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="#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 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.
