# AWS環境のセットアップ

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2FvZN6kGKPnGyndB6weVJ6%2Fimage.png?alt=media&#x26;token=d8ee992c-abfc-4f34-b1f2-6b6591048372" alt=""><figcaption></figcaption></figure>

## AWS環境の概要

AWS環境内のリソースは、EC2インスタンスロールポリシーか、PAM構成レコードで構成された特定のアクセスキーIDまたはシークレットアクセスキーを使用してKeeperゲートウェイで管理できます。

ロールポリシーは適切に設定し、対象のAWSリソースへアクセスできるようにする必要があります。

* EC2ロールポリシー
* IAMユーザーポリシー

以下の図は、AWS環境の階層構造です。

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2F9mN8yOT9hJuuWqw1KpWd%2Fimage.png?alt=media&#x26;token=727c3d5c-a054-4301-9578-2600d10f6e95" alt=""><figcaption></figcaption></figure>

## EC2 IAMロールポリシー <a href="#ec2-role" id="ec2-role"></a>

PAMの機能 (パスワードローテーションや検出など) をサポートするEC2 IAMポリシーを作成するには、適切なポリシー設定を持つロールを構成し、Keeperゲートウェイを実行するEC2インスタンスに適用する必要があります。

KeeperPAMでIAMユーザーやRDSデータベースのローテーションするには、以下のインラインロールポリシーを最小権限の原則に基づきつつニーズに応じて変更します。

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:SimulatePrincipalPolicy",
                "ec2:DescribeInstances",
                "rds:DescribeDBInstances",
                "ds:DescribeDirectories",
                "iam:ListUsers",
                "iam:GetUser",
                "iam:ListAccessKeys",
                "iam:UpdateLoginProfile",
                "rds:ModifyDBInstance",
                "ds:ResetUserPassword",
                "ds:DescribeLDAPSSettings",
                "ds:DescribeDomainControllers"
            ],
            "Resource": "*"
        }
    ]
}
```

最小権限を確保するために、KeeperPAMが管理する対象リソースに基づいて、JSONポリシーの「Action」および「Resource」属性を修正してください。

以下の手順に従って、新しいロールを作成してポリシーを適用します。

1. 上記のJSONでロールを作成するか、**\[IAM] > \[Roles] > \[Create Role]** をクリックし、**\[AWS Service]** を選択し、**\[EC2 use case]** を選択します。
2. 作成したロールに、ポリシーJSONを適用します。
3. **\[EC2] > \[Instances]** でゲートウェイを実行するインスタンスを選択し、**\[Actions] > \[Security] > \[Modify IAM Role]** に移動して新しいロールを選択します。

### 最小限のAWSポリシーでIAMユーザーを管理

<table><thead><tr><th width="370">管理するユーザータイプ</th><th>IAMポリシー</th></tr></thead><tbody><tr><td>EC2 User</td><td>ローテーションはローカル認証情報を使用し、特別なAWS権限は必要ありません。</td></tr><tr><td>Managed Database</td><td><p>ローテーションはAWS APIを使用してPAMデータベースレコードを操作し、以下が必要です。<br><br><strong>iam:GetUser</strong><br><strong>iam:SimulatePrincipalPolicy rds:ModifyDBInstance rds:DescribeDBInstances</strong></p><p><br>PAMデータベースやPAMユーザーレコードをSQL経由で管理する場合、AWS権限は必要ありません。</p></td></tr><tr><td>Directory User</td><td><p>ローテーションはAWS APIを使用してPAMディレクトリレコードを操作し、以下が必要です。<br></p><p><strong>iam:SimulatePrincipalPolicy ds:DescribeDirectories ds:ResetUserPassword ds:DescribeLDAPSSettings ds:DescribeDomainControllers</strong></p></td></tr><tr><td>IAM User</td><td><p>ローテーションはAWS APIを使用してPAMユーザーレコードを操作し、以下が必要です。<br></p><p><strong>iam:SimulatePrincipalPolicy iam:UpdateLoginProfile</strong><br><strong>iam:GetUser</strong></p></td></tr></tbody></table>

## IAMユーザーポリシー

EC2インスタンスロールポリシーの使用が推奨されますが、AWSアクセスキーIDおよびシークレットアクセスキーをPAM構成内で直接設定することも可能です。対象のAWSリソースにアクセスできるよう、適切なポリシー設定を構成したIAM管理者アカウントを作成する必要があります。

以下はサンプルのポリシーです。

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "VisualEditor0",
            "Effect": "Allow",
            "Action": [
                "iam:SimulatePrincipalPolicy",
                "ec2:DescribeInstances",
                "rds:DescribeDBInstances",
                "ds:DescribeDirectories",
                "iam:ListUsers",
                "iam:GetUser",
                "iam:ListAccessKeys",
                "iam:UpdateLoginProfile",
                "rds:ModifyDBInstance",
                "ds:ResetUserPassword",
                "ds:DescribeLDAPSSettings",
                "ds:DescribeDomainControllers"
            ],
            "Resource": "*"
        }
    ]
}
```

最小権限を確保するために、KeeperPAMが管理する対象リソースに基づいて、JSONポリシーの「Action」および「Resource」属性を変更します。

アクセスキーの作成手順

1. 新しいIAMユーザーを作成するか既存のユーザーを選択します。
2. ユーザーにポリシーを適用します。
3. IAMユーザー > **\[セキュリティ認証情報]** > **\[アクセスキーを作成]** を選択します。
4. **\[AWS の外部で実行されるアプリケーション]** を選択します。
5. 表示されるアクセスキーID / シークレットアクセスキーをPAM構成に保存します。

また、これらのポリシーに加えて、[AWS KMSを使用して](/keeperpam/jp/privileged-access-manager/getting-started/gateways/advanced-configuration/gateway-configuration-with-aws-kms.md)ゲートウェイ構成シークレットを保護することを推奨します。


---

# Agent Instructions: 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:

```
GET https://docs.keeper.io/keeperpam/jp/privileged-access-manager/getting-started/pam-configuration/aws-environment-setup.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
