【问题标题】:Chalice: Unable to connect with DynamoDB through pynamodb圣杯:无法通过 pynamodb 与 DynamoDB 连接
【发布时间】:2018-03-28 02:11:24
【问题描述】:

它在我配置了 .aws 的本地机器上运行良好。但是,lambda 无法通过自动生成的 iam 角色连接到 dynamodb 表。我什至尝试通过 IAM 控制台向角色显式添加策略:

{
            "Sid": "VisualEditor1",
            "Effect": "Allow",
            "Action": "dynamodb:*",
            "Resource": "arn:aws:dynamodb:ap-south-1:*:table/*"
}

但仍然出现此错误(调试日志):

An error occurred (AccessDeniedException) on request (SQ60ECK3UMM6LLEBC2K04S6HE7VV4KQNSO5AEMVJF66Q9ASUAAJG) on table (lmk_staging_posts) when calling the DescribeTable operation:
2018-02-26 00:11:18.723000 3ca1b0 [DEBUG]       2018-02-25T18:41:18.722Z                Calling DescribeTable with arguments {'TableName': 'lmk_staging_posts'}
2018-02-26 00:19:16.045000 5e175a [DEBUG]       2018-02-25T18:49:16.45Z         Calling DescribeTable with arguments {'TableName': 'lmk_staging_posts'}
2018-02-26 00:19:16.110000 5e175a [DEBUG]       2018-02-25T18:49:16.110Z                Calling DescribeTable with arguments {'TableName': 'lmk_staging_comments'}
2018-02-26 00:19:16.157000 5e175a [DEBUG]       2018-02-25T18:49:16.157Z                Calling DescribeTable with arguments {'TableName': 'lmk_staging_groups'}
2018-02-26 00:19:16.200000 5e175a [DEBUG]       2018-02-25T18:49:16.199Z                Calling DescribeTable with arguments {'TableName': 'lmk_staging_user_profile'}

【问题讨论】:

  • 您在正确的 VPC 上吗? idk 你的表和/或角色有什么样的安全配置

标签: python amazon-web-services amazon-dynamodb chalice


【解决方案1】:

您必须将"autogen_policy":false, 添加到config.json 并将您的所有策略放在policy-dev.json 中,例如:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup",
        "logs:CreateLogStream",
        "logs:PutLogEvents",
        "s3:*",
        "dynamodb:*"
      ],
      "Resource": "*"
    }
  ]
}

通过这种方式,您可以手动设置策略。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-05-17
    • 2011-11-03
    • 1970-01-01
    • 2011-02-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多