【问题标题】:How to grant Athena query permission to a Lambda function?如何向 Lambda 函数授予 Athena 查询权限?
【发布时间】:2019-12-03 15:34:24
【问题描述】:

我有一个查询 Amazon Athena 数据库的 AWS Lambda 函数。但是执行 Lambda 函数时出现权限错误:

调用 GetQueryExecution 操作时发生错误 (AccessDeniedException):用户:arn:aws:sts::773592622512:assumed-role/lambda_access-role/reddit_monitor is not authorized to perform:athena:GetQueryExecution on resource:arn:aws :athena:ap-southeast-2:773592622512:workgroup/primary: ClientError

我已经为 Lambda 函数创建了这个策略:

  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "athena:StartQueryExecution"
      ],
      "Effect": "Allow",
      "Resource": "*"
    },
    {
      "Action": [
        "s3:*"
      ],
      "Effect": "Allow",
      "Resource": [
            "arn:aws:s3:::${var.athena-bucket}",
            "arn:aws:s3:::${var.athena-bucket}/*"
        ]
    } 
  ]
}

我想知道为什么它仍然没有查询 Athena 的权限?我错过了什么吗?

【问题讨论】:

  • 您授予 athena:StartQueryExecution 而不是 athena:GetQueryExecution
  • 你是对的。请张贴作为我会接受的答案
  • 您在该问题中发布了您的 aws 帐户。你可能想要混淆它。

标签: amazon-web-services aws-lambda amazon-athena aws-security-group


【解决方案1】:

您授予athena:StartQueryExecution 而不是athena:GetQueryExecution

【讨论】:

    猜你喜欢
    • 2022-08-24
    • 2013-01-27
    • 1970-01-01
    • 1970-01-01
    • 2023-04-03
    • 2017-02-15
    • 2019-07-30
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多