创建AWS Glue爬虫 - Amazon WorkSpaces 应用程序

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

创建AWS Glue爬虫

AWS Glue是一项完全托管的提取、转换和加载 (ETL) 服务,允许您从 Amazon S3 数据创建数据库并使用 Athena 查询该数据库。该数据库也称为AWS Glue数据目录。AWS Glue爬虫可以自动检测您的 Amazon S3 数据的架构并创建相应的数据库和表。 WorkSpaces 应用程序提供了一个CloudFormation模板,您可以使用该模板来创建必要的AWS Glue资源。

重要

完成以下过程中的步骤将创建AWS Glue爬虫。但是,这些步骤不会启动爬网程序。要启动爬网程序,您必须执行下一过程中的步骤。有关AWS Glue抓取工具的更多信息,请参阅定义爬虫

创建AWS Glue爬虫
  1. https://console.aws.amazon.com/appstream2/家中打开 WorkSpaces 应用程序控制台。

  2. 选择您已订阅使用情况报告的AWS区域。

  3. 在导航窗格中,选择 Usage Reports (使用率报告),然后确认使用率报告日志记录已启用。

  4. 报告详细信息选项卡上,在 Analytics 旁边的段落中,选择CloudFormation模板链接。

    选择该链接将打开CloudFormation控制台,您可以在其中查看模板指定的CloudFormation堆栈参数,然后再运行该模板。该模板在运行时会创建一个AWS Glue爬虫和几个示例 Athena 查询。

  5. 在 “指定详细信息” 页面上,在旁边 ScheduleExpression,保留默认值或为要运行爬网程序的频率指定不同的 cron 表达式值。请勿更改任何其他默认值。完成此操作后,选择下一步

    默认情况下,爬网程序设定为每天运行,但您可以配置爬网程序每周、每月或以其他频率运行。有关 cron 语法的信息,请参阅 Cron 表达式

  6. Options (选项) 页面上,保留默认值,然后选择 Next (下一步)

  7. 在 “看” 页面上,选中 “我确认CloudFormation可能会使用自定义名称创建 IAM 资源” 旁边的复选框,然后选择 “创建”。

    您必须拥有足够的AWS Glue和 AWS Identity and Access Management (IAM) 权限才能创建和运行CloudFormation堆栈。如果您没有所需的权限,则要求您的 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" } ] }