

翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。

# AWS IoT Greengrass 認定スイートを実行するための前提条件
<a name="dev-tst-prereqs"></a>

このセクションでは、 AWS IoT Device Tester (IDT) を使用するための前提条件について説明します AWS IoT Greengrass。

## AWS IoT Device Tester for の最新バージョンをダウンロードする AWS IoT Greengrass
<a name="install-dev-tst-gg"></a>

IDT の[最新バージョン](idt-programmatic-download.md)をダウンロードし、ファイルシステム上で読み取り/書き込みのアクセス許可を持っている場所 (*<device-tester-extract-location>*) に抽出します。

**注記**  
<a name="unzip-package-to-local-drive"></a>複数のユーザーが NFS ディレクトリや Windows ネットワーク共有フォルダなどの共有場所から IDT を実行することはお勧めしません。IDT パッケージをローカルドライブに展開し、ローカルワークステーションで IDT バイナリを実行することをお勧めします。  
Windows では、パスの長さは 260 文字に制限されています。Windows を使用している場合は、パスが 260 文字以内になるようにして、IDT をルートディレクトリ (`C:\ ` または `D:\` など) に展開します。

## AWS IoT Greengrass ソフトウェアをダウンロードする
<a name="config-gg"></a>

IDT for AWS IoT Greengrass V2 は、特定のバージョンの との互換性についてデバイスをテストします AWS IoT Greengrass。次のコマンドを実行して、 AWS IoT Greengrass Core ソフトウェアを という名前のファイルにダウンロードします`aws.greengrass.nucleus.zip`。*version* を IDT バージョンの[サポートされている nucleus コンポーネントのバージョン](dev-test-versions.md)に置き換えます。

------
#### [ Linux or Unix ]

```
curl -s https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-version.zip > aws.greengrass.nucleus.zip
```

------
#### [ Windows Command Prompt (CMD) ]

```
curl -s https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-version.zip > aws.greengrass.nucleus.zip
```

------
#### [ PowerShell ]

```
iwr -Uri https://d2s8p88vqu9w66.cloudfront.net/releases/greengrass-version.zip -OutFile aws.greengrass.nucleus.zip
```

------

ダウンロードした `aws.greengrass.nucleus.zip` ファイルを `<device-tester-extract-location>/products/` フォルダに配置します。

**注記**  
同じオペレーティングシステムとアーキテクチャのこのディレクトリに複数のファイルを配置しないでください。

## の作成と設定 AWS アカウント
<a name="config-aws-account-for-idt"></a>

 AWS IoT Device Tester for AWS IoT Greengrass V2 を使用する前に、次の手順を実行する必要があります。

1. [をセットアップします AWS アカウント。](#create-aws-account-for-idt)が既にある場合は AWS アカウント、ステップ 2 に進みます。

1. [IDT 用のアクセス許可を設定する。](#configure-idt-permissions)

これらのアカウントのアクセス許可により、IDT はユーザーに代わって AWS サービスにアクセスし、 AWS IoT モノや AWS IoT Greengrass コンポーネントなどの AWS リソースを作成できます。

<a name="idt-aws-credentials"></a>これらのリソースを作成するために、IDT for AWS IoT Greengrass V2 は `config.json` ファイルで設定された AWS 認証情報を使用してユーザーに代わって API コールを行います。これらのリソースは、テスト中にさまざまなタイミングでプロビジョニングされます。

**注記**  
ほとんどのテストは [AWS 無料利用枠](https://aws.amazon.com/free)の対象となりますが、 AWS アカウントアカウントにサインアップするときにクレジットカードを提供する必要があります。詳細については、「[ アカウントが無料利用枠の対象であるのに、支払い方法が必要なのはなぜですか?](https://aws.amazon.com/premiumsupport/knowledge-center/free-tier-payment-method/)」を参照してください。

### ステップ 1: をセットアップする AWS アカウント
<a name="create-aws-account-for-idt"></a>

このステップでは、 AWS アカウントを作成して設定します。 AWS アカウントを既にお持ちの場合は、[ステップ 2: IDT 用のアクセス許可を設定する](#configure-idt-permissions) に進んでください。

がない場合は AWS アカウント、次の手順を実行して作成します。

**にサインアップするには AWS アカウント**

1. [https://portal.aws.amazon.com/billing/signup](https://portal.aws.amazon.com/billing/signup) を開きます。

1. オンラインの手順に従います。

   サインアップ手順の一環として、電話またはテキストメッセージを受け取り、電話キーパッドで検証コードを入力します。

   にサインアップすると AWS アカウント、 *AWS アカウントのルートユーザー* が作成されます。ルートユーザーには、アカウントのすべての AWS のサービス とリソースへのアクセス権があります。セキュリティベストプラクティスとして、ユーザーに管理アクセス権を割り当て、[ルートユーザーアクセスが必要なタスク](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_root-user.html#root-user-tasks)の実行にはルートユーザーのみを使用するようにしてください。

管理者ユーザーを作成するには、以下のいずれかのオプションを選択します。


****  

| 管理者を管理する方法を 1 つ選択します | 目的 | 方法 | 以下の操作も可能 | 
| --- | --- | --- | --- | 
| IAM アイデンティティセンター内 (推奨) | 短期の認証情報を使用して AWSにアクセスします。これはセキュリティのベストプラクティスと一致しています。ベストプラクティスの詳細については、「*IAM ユーザーガイド*」の「[IAM でのセキュリティのベストプラクティス](https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#bp-users-federation-idp)」を参照してください。 | AWS IAM アイデンティティセンター ユーザーガイドの「[開始方法](https://docs.aws.amazon.com//singlesignon/latest/userguide/getting-started.html)」の手順に従います。 | AWS Command Line Interface ユーザーガイドの [を使用する AWS CLI ように を設定 AWS IAM アイデンティティセンター](https://docs.aws.amazon.com//cli/latest/userguide/cli-configure-sso.html)して、プログラムによるアクセスを設定します。 | 
| IAM 内 (非推奨) | 長期認証情報を使用して AWSにアクセスします。 | IAM ユーザーガイドの「[緊急アクセス用の IAM ユーザーを作成する](https://docs.aws.amazon.com/IAM/latest/UserGuide/getting-started-emergency-iam-user.html)」の手順に従います。 | IAM ユーザーガイドの「[IAM ユーザーのアクセスキーを管理する](https://docs.aws.amazon.com//IAM/latest/UserGuide/id_credentials_access-keys.html)」の手順に従って、プログラムによるアクセスを設定します。 | 

### ステップ 2: IDT 用のアクセス許可を設定する
<a name="configure-idt-permissions"></a>

このステップでは、IDT for AWS IoT Greengrass V2 がテストを実行し、IDT 使用状況データを収集するために使用するアクセス許可を設定します。[AWS マネジメントコンソール](#configure-idt-permissions-console) または [AWS Command Line Interface (AWS CLI)](#configure-idt-permissions-cli) を使用して、IDT 用の IAM ポリシーとテストユーザーを作成し、そのユーザーにポリシーをアタッチできます。IDT 用のテストユーザーをすでに作成している場合は、[IDT テストを実行するようにデバイスを設定する](device-config-setup.md) に進みます。

#### IDT 用のアクセス許可を設定するには (コンソール)
<a name="configure-idt-permissions-console"></a>

1. [IAM コンソール](https://console.aws.amazon.com/iam)にサインインします。

1. 特定のアクセス許可を持つロールを作成するためのアクセス許可を付与するカスタマー管理ポリシーを作成します。

   1. ナビゲーションペインで **ポリシー**を選択してから **ポリシーの作成**を選択します。

   1. PreInstalled を使用していない場合は、**[JSON]** タブで、プレースホルダーの内容を次のポリシーに置き換えます。PreInstalled を使用している場合は、次のステップに進みます。

      ```
      <a name="customer-managed-policy-cli"></a>{
          "Version":"2012-10-17",		 	 	 
          "Statement":[
          {
            "Sid":"passRoleForResources",
            "Effect":"Allow",
            "Action":"iam:PassRole",
            "Resource":"arn:aws:iam::*:role/idt-*",
            "Condition":{
              "StringEquals":{
                "iam:PassedToService":[
                  "iot.amazonaws.com",
                  "lambda.amazonaws.com",
                  "greengrass.amazonaws.com"
                ]
              }
            }
          },
          {
            "Sid":"lambdaResources",
            "Effect":"Allow",
            "Action":[
              "lambda:CreateFunction",
              "lambda:PublishVersion",
              "lambda:DeleteFunction",
              "lambda:GetFunction"
            ],
            "Resource":[
              "arn:aws:lambda:*:*:function:idt-*"
            ]
          },
          {
            "Sid":"iotResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateThing",
              "iot:DeleteThing",
              "iot:DescribeThing",
              "iot:CreateThingGroup",
              "iot:DeleteThingGroup",
              "iot:DescribeThingGroup",
              "iot:AddThingToThingGroup",
              "iot:RemoveThingFromThingGroup",
              "iot:AttachThingPrincipal",
              "iot:DetachThingPrincipal",
              "iot:UpdateCertificate",
              "iot:DeleteCertificate",
              "iot:CreatePolicy",
              "iot:AttachPolicy",
              "iot:DetachPolicy",
              "iot:DeletePolicy",
              "iot:GetPolicy",
              "iot:Publish",
              "iot:TagResource",
              "iot:ListThingPrincipals",
              "iot:ListAttachedPolicies",
              "iot:ListTargetsForPolicy",
              "iot:ListThingGroupsForThing",
              "iot:ListThingsInThingGroup",
              "iot:CreateJob",
              "iot:DescribeJob",
              "iot:DescribeJobExecution",
              "iot:CancelJob"
            ],
            "Resource":[
              "arn:aws:iot:*:*:thing/idt-*",
              "arn:aws:iot:*:*:thinggroup/idt-*",
              "arn:aws:iot:*:*:policy/idt-*",
              "arn:aws:iot:*:*:cert/*",
              "arn:aws:iot:*:*:topic/idt-*",
              "arn:aws:iot:*:*:job/*"
            ]
          },
          {
            "Sid":"s3Resources",
            "Effect":"Allow",
            "Action":[
              "s3:GetObject",
              "s3:PutObject",
              "s3:DeleteObjectVersion",
              "s3:DeleteObject",
              "s3:CreateBucket",
              "s3:ListBucket",
              "s3:ListBucketVersions",
              "s3:DeleteBucket",
              "s3:PutObjectTagging",
              "s3:PutBucketTagging"
            ],
            "Resource":"arn:aws:s3::*:idt-*"
          },
          {
            "Sid":"roleAliasResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateRoleAlias",
              "iot:DescribeRoleAlias",
              "iot:DeleteRoleAlias",
              "iot:TagResource",
              "iam:GetRole"
            ],
            "Resource":[
              "arn:aws:iot:*:*:rolealias/idt-*",
              "arn:aws:iam::*:role/idt-*"
            ]
          },
          {
            "Sid":"idtExecuteAndCollectMetrics",
            "Effect":"Allow",
            "Action":[
              "iot-device-tester:SendMetrics",
              "iot-device-tester:SupportedVersion",
              "iot-device-tester:LatestIdt",
              "iot-device-tester:CheckVersion",
              "iot-device-tester:DownloadTestSuite"
            ],
            "Resource":"*"
          },
          {
            "Sid":"genericResources",
            "Effect":"Allow",
            "Action":[
              "greengrass:*",
              "iot:GetThingShadow",
              "iot:UpdateThingShadow",
              "iot:ListThings",
              "iot:DescribeEndpoint",
              "iot:CreateKeysAndCertificate"
            ],
            "Resource":"*"
          },
          {
            "Sid":"iamResourcesUpdate",
            "Effect":"Allow",
            "Action":[
              "iam:CreateRole",
              "iam:DeleteRole",
              "iam:CreatePolicy",
              "iam:DeletePolicy",
              "iam:AttachRolePolicy",
              "iam:DetachRolePolicy",
              "iam:TagRole",
              "iam:TagPolicy",
              "iam:GetPolicy",
              "iam:ListAttachedRolePolicies",
              "iam:ListEntitiesForPolicy"
            ],
            "Resource":[
              "arn:aws:iam::*:role/idt-*",
              "arn:aws:iam::*:policy/idt-*"
            ]
          }
        ]
      }
      ```

   1. PreInstalled を使用している場合は、**[JSON]** タブで、プレースホルダーの内容を次のポリシーに置き換えます。必ず次のことを行ってください。
      + `iotResources` ステートメント内の *thingName* と *thingGroup* を、テスト対象デバイス (DUT) への Greengrass のインストール中に作成されたモノの名前とモノのグループに置き換えて、許可を追加します。
      + `roleAliasResources` ステートメントおよび `passRoleForResources` ステートメントの *passRole* と *roleAlias* を、DUT への Greengrass のインストール中に作成されたロールに置き換えます。

      ```
      <a name="customer-managed-policy-cli"></a>{
          "Version":"2012-10-17",		 	 	 
          "Statement":[
          {
            "Sid":"passRoleForResources",
            "Effect":"Allow",
            "Action":"iam:PassRole",
            "Resource":"arn:aws:iam::*:role/passRole",
            "Condition":{
              "StringEquals":{
                "iam:PassedToService":[
                  "iot.amazonaws.com",
                  "lambda.amazonaws.com",
                  "greengrass.amazonaws.com"
                ]
              }
            }
          },
          {
            "Sid":"lambdaResources",
            "Effect":"Allow",
            "Action":[
              "lambda:CreateFunction",
              "lambda:PublishVersion",
              "lambda:DeleteFunction",
              "lambda:GetFunction"
            ],
            "Resource":[
              "arn:aws:lambda:*:*:function:idt-*"
            ]
          },
          {
            "Sid":"iotResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateThing",
              "iot:DeleteThing",
              "iot:DescribeThing",
              "iot:CreateThingGroup",
              "iot:DeleteThingGroup",
              "iot:DescribeThingGroup",
              "iot:AddThingToThingGroup",
              "iot:RemoveThingFromThingGroup",
              "iot:AttachThingPrincipal",
              "iot:DetachThingPrincipal",
              "iot:UpdateCertificate",
              "iot:DeleteCertificate",
              "iot:CreatePolicy",
              "iot:AttachPolicy",
              "iot:DetachPolicy",
              "iot:DeletePolicy",
              "iot:GetPolicy",
              "iot:Publish",
              "iot:TagResource",
              "iot:ListThingPrincipals",
              "iot:ListAttachedPolicies",
              "iot:ListTargetsForPolicy",
              "iot:ListThingGroupsForThing",
              "iot:ListThingsInThingGroup",
              "iot:CreateJob",
              "iot:DescribeJob",
              "iot:DescribeJobExecution",
              "iot:CancelJob"
            ],
            "Resource":[
              "arn:aws:iot:*:*:thing/thingName",
              "arn:aws:iot:*:*:thinggroup/thingGroup",
              "arn:aws:iot:*:*:policy/idt-*",
              "arn:aws:iot:*:*:cert/*",
              "arn:aws:iot:*:*:topic/idt-*",
              "arn:aws:iot:*:*:job/*"
            ]
          },
          {
            "Sid":"s3Resources",
            "Effect":"Allow",
            "Action":[
              "s3:GetObject",
              "s3:PutObject",
              "s3:DeleteObjectVersion",
              "s3:DeleteObject",
              "s3:CreateBucket",
              "s3:ListBucket",
              "s3:ListBucketVersions",
              "s3:DeleteBucket",
              "s3:PutObjectTagging",
              "s3:PutBucketTagging"
            ],
            "Resource":"arn:aws:s3::*:idt-*"
          },
          {
            "Sid":"roleAliasResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateRoleAlias",
              "iot:DescribeRoleAlias",
              "iot:DeleteRoleAlias",
              "iot:TagResource",
              "iam:GetRole"
            ],
            "Resource":[
              "arn:aws:iot:*:*:rolealias/roleAlias",
              "arn:aws:iam::*:role/idt-*"
            ]
          },
          {
            "Sid":"idtExecuteAndCollectMetrics",
            "Effect":"Allow",
            "Action":[
              "iot-device-tester:SendMetrics",
              "iot-device-tester:SupportedVersion",
              "iot-device-tester:LatestIdt",
              "iot-device-tester:CheckVersion",
              "iot-device-tester:DownloadTestSuite"
            ],
            "Resource":"*"
          },
          {
            "Sid":"genericResources",
            "Effect":"Allow",
            "Action":[
              "greengrass:*",
              "iot:GetThingShadow",
              "iot:UpdateThingShadow",
              "iot:ListThings",
              "iot:DescribeEndpoint",
              "iot:CreateKeysAndCertificate"
            ],
            "Resource":"*"
          },
          {
            "Sid":"iamResourcesUpdate",
            "Effect":"Allow",
            "Action":[
              "iam:CreateRole",
              "iam:DeleteRole",
              "iam:CreatePolicy",
              "iam:DeletePolicy",
              "iam:AttachRolePolicy",
              "iam:DetachRolePolicy",
              "iam:TagRole",
              "iam:TagPolicy",
              "iam:GetPolicy",
              "iam:ListAttachedRolePolicies",
              "iam:ListEntitiesForPolicy"
            ],
            "Resource":[
              "arn:aws:iam::*:role/idt-*",
              "arn:aws:iam::*:policy/idt-*"
            ]
          }
        ]
      }
      ```
**注記**  
テスト対象のデバイスの[トークン交換ロールとしてカスタム IAM ロール](set-config.md#custom-token-exchange-role-idt)を使用する場合は、カスタム IAM ロールリソースを許可するように、ポリシーの `roleAliasResources` ステートメントと `passRoleForResources` ステートメントを必ず更新してください。

   1. **[ポリシーの確認]** を選択します。

   1. **[Name]** (名前) に **IDTGreengrassIAMPermissions** と入力します。[**概要**] で、ポリシーによって付与されたアクセス許可を確認します。

   1. [**Create policy**] (ポリシーの作成) を選択します。

1. IAM ユーザーを作成し、IDT for AWS IoT Greengrassに必要なアクセス許可をアタッチします。

   1. IAM ユーザーを作成します。IAM ユーザーガイドの [IAM ユーザーの作成 (コンソール)](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html#id_users_create_console) のステップ 1 ～ 5 に従います。**

   1. アクセス許可を IAM ユーザーにアタッチします。

      1. [**Set permissions**] ページで、[**Attach existing policies to user directly**] を選択します。

      1. 前のステップで作成した **IDTGreengrassIAMPermissions** ポリシーを検索します。チェックボックスをオンにします。

   1. **[Next: Tags]** (次へ: タグ) を選択します。

   1. [**Next: Review**] (次へ: レビュー) を選択して、選択内容の概要を表示します。

   1. **[ユーザーの作成]** を選択します。

   1. ユーザーのアクセスキー (アクセスキー ID とシークレットアクセスキー) を表示するには、パスワードとアクセスキーの横にある [**Show (表示)**] を選択します。アクセスキーを保存するには、[**Download .csv**] を選択し、安全な場所にファイルを保存します。この情報を後で使用して、 AWS 認証情報ファイルを設定します。

1. <a name="aws-account-config-next-steps"></a>次のステップ: [物理デバイス](device-config-setup.md)を設定します。

#### IDT 用のアクセス許可を設定するには (AWS CLI)
<a name="configure-idt-permissions-cli"></a>

1. コンピュータで、まだインストール AWS CLI されていない場合は、 をインストールして設定します。AWS Command Line Interface ユーザーガイドの [AWS CLIのインストール](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html)のステップに従います。**
**注記**  
 AWS CLI は、コマンドラインシェルから AWS サービスとやり取りするために使用できるオープンソースツールです。

1. IDT と AWS IoT Greengrass ロールを管理するためのアクセス許可を付与するカスタマー管理ポリシーを作成します。

   1. PreInstalled を使用していない場合は、テキストエディタを開き、次のポリシーコンテンツを JSON ファイルに保存します。PreInstalled を使用している場合は、次のステップに進みます。

      ```
      <a name="customer-managed-policy-cli"></a>{
          "Version":"2012-10-17",		 	 	 
          "Statement":[
          {
            "Sid":"passRoleForResources",
            "Effect":"Allow",
            "Action":"iam:PassRole",
            "Resource":"arn:aws:iam::*:role/idt-*",
            "Condition":{
              "StringEquals":{
                "iam:PassedToService":[
                  "iot.amazonaws.com",
                  "lambda.amazonaws.com",
                  "greengrass.amazonaws.com"
                ]
              }
            }
          },
          {
            "Sid":"lambdaResources",
            "Effect":"Allow",
            "Action":[
              "lambda:CreateFunction",
              "lambda:PublishVersion",
              "lambda:DeleteFunction",
              "lambda:GetFunction"
            ],
            "Resource":[
              "arn:aws:lambda:*:*:function:idt-*"
            ]
          },
          {
            "Sid":"iotResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateThing",
              "iot:DeleteThing",
              "iot:DescribeThing",
              "iot:CreateThingGroup",
              "iot:DeleteThingGroup",
              "iot:DescribeThingGroup",
              "iot:AddThingToThingGroup",
              "iot:RemoveThingFromThingGroup",
              "iot:AttachThingPrincipal",
              "iot:DetachThingPrincipal",
              "iot:UpdateCertificate",
              "iot:DeleteCertificate",
              "iot:CreatePolicy",
              "iot:AttachPolicy",
              "iot:DetachPolicy",
              "iot:DeletePolicy",
              "iot:GetPolicy",
              "iot:Publish",
              "iot:TagResource",
              "iot:ListThingPrincipals",
              "iot:ListAttachedPolicies",
              "iot:ListTargetsForPolicy",
              "iot:ListThingGroupsForThing",
              "iot:ListThingsInThingGroup",
              "iot:CreateJob",
              "iot:DescribeJob",
              "iot:DescribeJobExecution",
              "iot:CancelJob"
            ],
            "Resource":[
              "arn:aws:iot:*:*:thing/idt-*",
              "arn:aws:iot:*:*:thinggroup/idt-*",
              "arn:aws:iot:*:*:policy/idt-*",
              "arn:aws:iot:*:*:cert/*",
              "arn:aws:iot:*:*:topic/idt-*",
              "arn:aws:iot:*:*:job/*"
            ]
          },
          {
            "Sid":"s3Resources",
            "Effect":"Allow",
            "Action":[
              "s3:GetObject",
              "s3:PutObject",
              "s3:DeleteObjectVersion",
              "s3:DeleteObject",
              "s3:CreateBucket",
              "s3:ListBucket",
              "s3:ListBucketVersions",
              "s3:DeleteBucket",
              "s3:PutObjectTagging",
              "s3:PutBucketTagging"
            ],
            "Resource":"arn:aws:s3::*:idt-*"
          },
          {
            "Sid":"roleAliasResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateRoleAlias",
              "iot:DescribeRoleAlias",
              "iot:DeleteRoleAlias",
              "iot:TagResource",
              "iam:GetRole"
            ],
            "Resource":[
              "arn:aws:iot:*:*:rolealias/idt-*",
              "arn:aws:iam::*:role/idt-*"
            ]
          },
          {
            "Sid":"idtExecuteAndCollectMetrics",
            "Effect":"Allow",
            "Action":[
              "iot-device-tester:SendMetrics",
              "iot-device-tester:SupportedVersion",
              "iot-device-tester:LatestIdt",
              "iot-device-tester:CheckVersion",
              "iot-device-tester:DownloadTestSuite"
            ],
            "Resource":"*"
          },
          {
            "Sid":"genericResources",
            "Effect":"Allow",
            "Action":[
              "greengrass:*",
              "iot:GetThingShadow",
              "iot:UpdateThingShadow",
              "iot:ListThings",
              "iot:DescribeEndpoint",
              "iot:CreateKeysAndCertificate"
            ],
            "Resource":"*"
          },
          {
            "Sid":"iamResourcesUpdate",
            "Effect":"Allow",
            "Action":[
              "iam:CreateRole",
              "iam:DeleteRole",
              "iam:CreatePolicy",
              "iam:DeletePolicy",
              "iam:AttachRolePolicy",
              "iam:DetachRolePolicy",
              "iam:TagRole",
              "iam:TagPolicy",
              "iam:GetPolicy",
              "iam:ListAttachedRolePolicies",
              "iam:ListEntitiesForPolicy"
            ],
            "Resource":[
              "arn:aws:iam::*:role/idt-*",
              "arn:aws:iam::*:policy/idt-*"
            ]
          }
        ]
      }
      ```

   1. PreInstalled を使用している場合は、テキストエディタを開き、次のポリシーコンテンツを JSON ファイルに保存します。必ず次のことを行ってください。
      + テスト対象デバイス (DUT) への Greengrass のインストール中に作成された `iotResources` ステートメント内の *thingName* と *thingGroup* を置き換えて、許可を追加します。
      + `roleAliasResources` ステートメントおよび `passRoleForResources` ステートメントの *passRole* と *roleAlias* を、DUT への Greengrass のインストール中に作成されたロールに置き換えます。

      ```
      <a name="customer-managed-policy-cli"></a>{
          "Version":"2012-10-17",		 	 	 
          "Statement":[
          {
            "Sid":"passRoleForResources",
            "Effect":"Allow",
            "Action":"iam:PassRole",
            "Resource":"arn:aws:iam::*:role/passRole",
            "Condition":{
              "StringEquals":{
                "iam:PassedToService":[
                  "iot.amazonaws.com",
                  "lambda.amazonaws.com",
                  "greengrass.amazonaws.com"
                ]
              }
            }
          },
          {
            "Sid":"lambdaResources",
            "Effect":"Allow",
            "Action":[
              "lambda:CreateFunction",
              "lambda:PublishVersion",
              "lambda:DeleteFunction",
              "lambda:GetFunction"
            ],
            "Resource":[
              "arn:aws:lambda:*:*:function:idt-*"
            ]
          },
          {
            "Sid":"iotResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateThing",
              "iot:DeleteThing",
              "iot:DescribeThing",
              "iot:CreateThingGroup",
              "iot:DeleteThingGroup",
              "iot:DescribeThingGroup",
              "iot:AddThingToThingGroup",
              "iot:RemoveThingFromThingGroup",
              "iot:AttachThingPrincipal",
              "iot:DetachThingPrincipal",
              "iot:UpdateCertificate",
              "iot:DeleteCertificate",
              "iot:CreatePolicy",
              "iot:AttachPolicy",
              "iot:DetachPolicy",
              "iot:DeletePolicy",
              "iot:GetPolicy",
              "iot:Publish",
              "iot:TagResource",
              "iot:ListThingPrincipals",
              "iot:ListAttachedPolicies",
              "iot:ListTargetsForPolicy",
              "iot:ListThingGroupsForThing",
              "iot:ListThingsInThingGroup",
              "iot:CreateJob",
              "iot:DescribeJob",
              "iot:DescribeJobExecution",
              "iot:CancelJob"
            ],
            "Resource":[
              "arn:aws:iot:*:*:thing/thingName",
              "arn:aws:iot:*:*:thinggroup/thingGroup",
              "arn:aws:iot:*:*:policy/idt-*",
              "arn:aws:iot:*:*:cert/*",
              "arn:aws:iot:*:*:topic/idt-*",
              "arn:aws:iot:*:*:job/*"
            ]
          },
          {
            "Sid":"s3Resources",
            "Effect":"Allow",
            "Action":[
              "s3:GetObject",
              "s3:PutObject",
              "s3:DeleteObjectVersion",
              "s3:DeleteObject",
              "s3:CreateBucket",
              "s3:ListBucket",
              "s3:ListBucketVersions",
              "s3:DeleteBucket",
              "s3:PutObjectTagging",
              "s3:PutBucketTagging"
            ],
            "Resource":"arn:aws:s3::*:idt-*"
          },
          {
            "Sid":"roleAliasResources",
            "Effect":"Allow",
            "Action":[
              "iot:CreateRoleAlias",
              "iot:DescribeRoleAlias",
              "iot:DeleteRoleAlias",
              "iot:TagResource",
              "iam:GetRole"
            ],
            "Resource":[
              "arn:aws:iot:*:*:rolealias/roleAlias",
              "arn:aws:iam::*:role/idt-*"
            ]
          },
          {
            "Sid":"idtExecuteAndCollectMetrics",
            "Effect":"Allow",
            "Action":[
              "iot-device-tester:SendMetrics",
              "iot-device-tester:SupportedVersion",
              "iot-device-tester:LatestIdt",
              "iot-device-tester:CheckVersion",
              "iot-device-tester:DownloadTestSuite"
            ],
            "Resource":"*"
          },
          {
            "Sid":"genericResources",
            "Effect":"Allow",
            "Action":[
              "greengrass:*",
              "iot:GetThingShadow",
              "iot:UpdateThingShadow",
              "iot:ListThings",
              "iot:DescribeEndpoint",
              "iot:CreateKeysAndCertificate"
            ],
            "Resource":"*"
          },
          {
            "Sid":"iamResourcesUpdate",
            "Effect":"Allow",
            "Action":[
              "iam:CreateRole",
              "iam:DeleteRole",
              "iam:CreatePolicy",
              "iam:DeletePolicy",
              "iam:AttachRolePolicy",
              "iam:DetachRolePolicy",
              "iam:TagRole",
              "iam:TagPolicy",
              "iam:GetPolicy",
              "iam:ListAttachedRolePolicies",
              "iam:ListEntitiesForPolicy"
            ],
            "Resource":[
              "arn:aws:iam::*:role/idt-*",
              "arn:aws:iam::*:policy/idt-*"
            ]
          }
        ]
      }
      ```
**注記**  
テスト対象のデバイスの[トークン交換ロールとしてカスタム IAM ロール](set-config.md#custom-token-exchange-role-idt)を使用する場合は、カスタム IAM ロールリソースを許可するように、ポリシーの `roleAliasResources` ステートメントと `passRoleForResources` ステートメントを必ず更新してください。

   1. 次のコマンドを実行して、`IDTGreengrassIAMPermissions` という名前でカスタマー管理ポリシーを作成します。`policy.json` を前のステップで作成した JSON ファイルへのフルパスに置き換えます。

      ```
      aws iam create-policy --policy-name IDTGreengrassIAMPermissions --policy-document file://policy.json
      ```

1. IAM ユーザーを作成し、IDT for AWS IoT Greengrassに必要なアクセス許可をアタッチします。

   1. IAM ユーザーを作成します。このセットアップ例では、ユーザーは `IDTGreengrassUser` という名前になります。

      ```
      aws iam create-user --user-name IDTGreengrassUser
      ```

   1. ステップ 2 で作成した `IDTGreengrassIAMPermissions` ポリシーを IAM ユーザーにアタッチします。コマンドの *<account-id>* を の ID に置き換えます AWS アカウント。

      ```
      aws iam attach-user-policy --user-name IDTGreengrassUser --policy-arn arn:aws:iam::<account-id>:policy/IDTGreengrassIAMPermissions
      ```

1. ユーザーのシークレットアクセスキーを作成します。

   ```
   aws iam create-access-key --user-name IDTGreengrassUser
   ```

   この出力は安全な場所に保存してください。後でこの情報を使用して認証情報 AWS ファイルを設定します。

1. <a name="aws-account-config-next-steps"></a>次のステップ: [物理デバイス](device-config-setup.md)を設定します。

### AWS IoT Device Tester アクセス許可
<a name="gg-idt-managed-policy"></a>

次のポリシーでは、 AWS IoT Device Tester アクセス許可について説明します。

AWS IoT Device Tester では、バージョンチェックと自動更新機能にこれらのアクセス許可が必要です。
+ `iot-device-tester:SupportedVersion`

  サポートされている製品、テストスイート、IDT バージョンのリストを取得する AWS IoT Device Tester アクセス許可を付与します。
+ `iot-device-tester:LatestIdt`

  ダウンロード可能な最新の IDT バージョンを取得する AWS IoT Device Tester アクセス許可を付与します。
+ `iot-device-tester:CheckVersion`

  IDT、テストスイート、製品のバージョンの互換性をチェックする AWS IoT Device Tester アクセス許可を付与します。
+ `iot-device-tester:DownloadTestSuite`

  テストスイートの更新をダウンロードする AWS IoT Device Tester アクセス許可を付与します。

AWS IoT Device Tester は、オプションのメトリクスレポートにも次のアクセス許可を使用します。
+ `iot-device-tester:SendMetrics`

   AWS IoT Device Tester 内部使用状況に関するメトリクスを収集 AWS するためのアクセス許可を付与します。この権限を省略すると、これらのメトリックは収集されません。