

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

# AWS Glue クローラを作成する
<a name="configure-custom-reports-create-crawler"></a>

AWS Glue は、Amazon S3 データからデータベースを作成し、Athena を使用してそのデータベースをクエリできるフルマネージド抽出、変換、ロード (ETL) サービスです。このデータベースは、 AWS Glue データカタログとも呼ばれます。 AWS Glue クローラは、Amazon S3 データのスキーマを自動的に検出し、対応するデータベースとテーブルを作成できます。WorkSpaces Applications には、必要な AWS Glue リソースを作成するために使用できる CloudFormation テンプレートが用意されています。

**重要**  
次の手順のステップを完了すると AWS Glue 、 クローラが作成されます。ただし、これらのステップではクローラを起動しません。クローラを起動するには、次の手順のステップを実行する必要があります。 AWS Glue クローラの詳細については、[「クローラの定義](https://docs.aws.amazon.com/glue/latest/dg/add-crawler.html)」を参照してください。

**AWS Glue クローラを作成するには**

1. [https://console.aws.amazon.com/appstream2/home](https://console.aws.amazon.com/appstream2/home) で WorkSpaces アプリケーションコンソールを開きます。

1. 使用状況レポートをサブスクライブしている AWS リージョンを選択します。

1. ナビゲーションペインで、[**Usage Reports (使用状況レポート)**] を選択し、使用状況レポートのログ記録が有効になっていることを確認します。

1. [**Report Details (レポートの詳細)**] タブの [**分析**] の横にある [**CloudFormation テンプレート**] リンクをクリックします。

   リンクを選択すると CloudFormation コンソールが開き、テンプレートで指定された CloudFormation スタックのパラメータを確認してから実行できます。テンプレートを実行すると、 AWS Glue クローラといくつかのサンプル Athena クエリが作成されます。

1. [**詳細の指定**] ページの [**ScheduleExpression**] の横にあるデフォルト値をそのまま使用するか、クローラを実行する頻度に別の cron 式の値を指定します。他のデフォルト値は変更しないでください。終了したら、[**Next (次へ)**] を選択します。

   クローラはデフォルトで、毎日実行されるようにスケジュールされていますが、毎週、毎月、または別の頻度で実行されるように設定できます。cron 構文については、「[Cron 式](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/ScheduledEvents.html#CronExpressions)」を参照してください。

1. [**オプション**] ページで、すべてのデフォルト値を受け入れ、[**Next (次へ)**] を選択します。

1. Review ****ページで、「I acknowledge that CloudFormation might create IAM resources with custom names」の横にあるチェックボックスを選択し、**「Create**」を選択します。

    CloudFormation スタックを作成および実行するには、十分な AWS Glue および AWS Identity and Access Management (IAM) アクセス許可が必要です。必要なアクセス許可がない場合は、お客様の Amazon Web Services アカウント管理者に対し、アカウントでこれらのステップを実行するか、以下のアクセス許可をお客様に付与するかのどちらかを依頼します。

------
#### [ JSON ]

****  

   ```
   {
       "Version":"2012-10-17",		 	 	 
       "Statement": [
           {
               "Effect": "Allow",
               "Action": [
                   "athena:CreateNamedQuery",
                   "athena:BatchGetNamedQuery",
                   "athena:GetNamedQuery",
                   "athena:StartQueryExecution",
                   "athena:GetQueryResults",
                   "athena:GetQueryExecution",
                   "athena:ListNamedQueries",
                   "cloudformation:DescribeStacks",
                   "cloudformation:GetStackPolicy",
                   "cloudformation:DescribeStackEvents",
                   "cloudformation:CreateStack",
                   "cloudformation:GetTemplate",
                   "cloudformation:ListChangeSets",
                   "cloudformation:ListStackResources",
                   "iam:GetRole",
                   "iam:CreateRole",
                   "iam:GetRolePolicy",
                   "s3:GetBucketLocation",
                   "s3:ListBucketMultipartUploads",
                   "s3:ListBucket",
                   "s3:ListMultipartUploadParts",
                   "s3:PutObject",
                   "s3:GetObject",
                   "s3:AbortMultipartUpload"
               ],
               "Resource": [
                   "arn:aws:iam::*:role/AppStreamUsageReports-AppStreamUsageReportGlueRole*",
                   "arn:aws:cloudformation:*:*:stack/AppStreamUsageReports/*",
                   "arn:aws:athena:*:*:workgroup/primary",
                   "arn:aws:s3:::aws-athena-query-results-*"
               ]
           },
           {
               "Effect": "Allow",
               "Action": [
                   "iam:AttachRolePolicy",
                   "iam:PutRolePolicy",
                   "s3:GetObject",
                   "s3:ListBucket"
               ],
               "Resource": [
                   "arn:aws:s3:::appstream-logs-*",
                   "arn:aws:iam::*:role/AppStreamUsageReports-AppStreamUsageReportGlueRole*"
               ]
           },
           {
               "Effect": "Allow",
               "Action": [
                   "iam:PassRole"
               ],
               "Resource": [
                   "arn:aws:iam::*:role/AppStreamUsageReports-AppStreamUsageReportGlueRole*"
               ],
               "Condition": {
                   "StringEquals": {
                       "iam:PassedToService": "glue.amazonaws.com"
                   }
               }
           },
           {
               "Effect": "Allow",
               "Action": [
                   "cloudformation:GetTemplateSummary",
                   "glue:GetResourcePolicy",
                   "glue:GetCrawlers",
                   "glue:BatchGetCrawlers",
                   "glue:GetClassifiers",
                   "glue:CreateClassifier",
                   "glue:ListCrawlers",
                   "glue:GetTags",
                   "glue:GetCrawlerMetrics",
                   "glue:GetClassifier",
                   "tag:GetResources"
               ],
               "Resource": "*"
           },
           {
               "Effect": "Allow",
               "Action": "athena:RunQuery",
               "Resource": "arn:aws:athena:*:*:workgroup/primary"
           },
           {
               "Effect": "Allow",
               "Action": [
                   "glue:GetTables",
                   "glue:GetPartitions",
                   "glue:GetTable"
               ],
               "Resource": [
                   "arn:aws:glue:*:*:table/appstream-usage/*",
                   "arn:aws:glue:*:*:database/appstream-usage",
                   "arn:aws:glue:*:*:catalog"
               ]
           },
           {
               "Effect": "Allow",
               "Action": [
                   "glue:GetDatabase",
                   "glue:CreateDatabase",
                   "glue:GetDatabases"
               ],
               "Resource": [
                   "arn:aws:glue:*:*:database/appstream-usage",
                   "arn:aws:glue:*:*:catalog"
               ]
           },
           {
               "Effect": "Allow",
               "Action": [
                   "glue:GetCrawler",
                   "glue:StartCrawler",
                   "glue:CreateCrawler"
               ],
               "Resource": "arn:aws:glue:*:*:crawler/appstream-usage*"
           },
           {
               "Effect": "Allow",
               "Action": "glue:GetCatalogImportStatus",
               "Resource": "arn:aws:glue:*:*:catalog"
           }
       ]
   }
   ```

------