amazon-web-services - AWS Glue 无法从爬虫 : permission denied 创建数据库

标签 amazon-web-services amazon-athena aws-glue

我正在尝试在 S3 存储桶上使用 AWS Glue 爬网程序来填充 Glue 数据库。我运行 Create Crawler 向导,选择我的数据源(带有 avro 文件的 S3 存储桶),让它创建 IAM 角色并运行它,但我收到以下错误:

Database does not exist or principal is not authorized to create tables. (Database name: zzz-db, Table name: avroavro_all) (Service: AWSGlue; Status Code: 400; Error Code: AccessDeniedException; Request ID: 78fc18e4-c383-11e9-a86f-736a16f57a42). For more information, see Setting up IAM Permissions in the Developer Guide (http://docs.aws.amazon.com/glue/latest/dg/getting-started-access.html).

我尝试在一个新的空白数据库中创建这个表(而不是现有的带有表的数据库),我尝试为名称添加前缀,尝试获取不同的模式,并尝试使用具有管理员访问权限的现有角色。我虽然后者会工作,但我一直收到同样的错误,不知道为什么。

明确地说,我创建的服务角色有几个策略,我假设一个足以创建表的前提:

enter image description here

日志是 Vanilla :

19:52:52
[10cb3191-9785-49dc-8935-fb02dcbd69a3] BENCHMARK : Running Start Crawl for Crawler avro
19:53:22
[10cb3191-9785-49dc-8935-fb02dcbd69a3] BENCHMARK : Classification complete, writing results to database zzz-db
19:53:22
[10cb3191-9785-49dc-8935-fb02dcbd69a3] INFO : Crawler configured with SchemaChangePolicy {"UpdateBehavior":"UPDATE_IN_DATABASE","DeleteBehavior":"DEPRECATE_IN_DATABASE"}.
19:53:34
[10cb3191-9785-49dc-8935-fb02dcbd69a3] ERROR : Insufficient Lake Formation permission(s) on s3://zzz-data/avro-all/ (Database name: zzz-db, Table name: avroavro_all) (Service: AWSGlue; Status Code: 400; Error Code: AccessDeniedException; Request ID: 31481e7e-c384-11e9-a6e1-e78dc8223fae). For more information, see Setting up IAM Permissions in the Developer Guide (http://docs.aws.amazon.com/glu
19:54:44
[10cb3191-9785-49dc-8935-fb02dcbd69a3] BENCHMARK : Crawler has finished running and is in state READY

最佳答案

在启用 Lake Formation(在同一 AWS 账户中)后设置并运行新的 AWS 爬网程序时,我遇到了同样的问题。我已经运行 Glue 爬虫很长时间了,当我看到这个新错误时被难住了。

经过反复试验,我发现问题的根本原因是当您启用 Lake Formation 时,它会为通过 Glue Crawler 创建的新 Glue 数据库以及任何资源(Glue 目录、 S3 等),您将其添加到 Lake Formation 服务。

要解决此问题,您必须授予 Crawler 的 IAM 角色,即数据库的一组适当的 Lake Formation 权限 (CRUD)。

您可以在权限 > 数据权限部分下的 AWS Lake Formation 控制台 (UI) 中或通过 awscli Lake Formation 命令管理这些权限。

关于amazon-web-services - AWS Glue 无法从爬虫 : permission denied 创建数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57581398/

相关文章:

amazon-web-services - AWS Glue ApplyMapping 从 double 到字符串

aws-glue - 使用 AWS Glue 将 AWS Redshift 转换为 S3 Parquet 文件

amazon-web-services - EC2 UserData 脚本在启动时未运行

amazon-web-services - 自定义注册表的示例对象路径

amazon-web-services - 在 AWS Glue pySpark 脚本中使用 SQL

sql - 将带有时间戳列的 csv 加载到 athena 表

spring - Spring 集成扩展是否是最新且可用的?

amazon-web-services - AWS API 网关无法执行 lambda?

python - AWS Athena 使用填充有错误数据的创建表从 Epoch 到时间戳的转换

aws-glue - AWS Glue Job运行太慢