【问题标题】:How do I add permissions in Amazon Keyspaces?如何在 Amazon Keyspaces 中添加权限?
【发布时间】:2021-05-08 16:09:09
【问题描述】:

当我尝试从 AWS Lambda 查询 AWS Keyspaces(托管 Cassandra)时,我收到以下错误:

{
  "errorType": "AggregateException",
  "errorMessage": "One or more errors occurred. (All hosts tried for query failed (tried 11.11.111.11:9142: UnauthorizedException 'User arn:aws:iam::111111111111:user/user-for-keyspaces has no permissions.'; 11.11.111.11:9142: UnauthorizedException 'User arn:aws:iam::111111111111:user/user-for-keyspaces has no permissions.'))",
  "stackTrace": [
    "at lambda_method(Closure , Stream , Stream , LambdaContextInternal )"
  ],
  "cause": {
    "errorType": "NoHostAvailableException",
...

但在密钥空间的 AWS 控制台中,我看不到任何地方可以添加权限。

user-for-keyspaces 的用户政策已附上此内容:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Action": [
        "cassandra:*"
      ],
      "Effect": "Allow",
      "Resource": "*"
    }
  ]
}

如何在 AWS Keyspaces 中添加权限?

【问题讨论】:

  • this 不是您要找的吗?
  • @Marcin 是的,我在 IAM 安全选项卡中生成了凭证。不过,我现在想通了。

标签: amazon-web-services cassandra amazon-keyspaces


【解决方案1】:

问题实际上与错误消息中的用户无关,而是我为 Keyspaces 创建的 VPC 端点。

端点需要cassandra:* 权限才能执行查询,例如

      {
        "Statement": [
          {
            "Sid": "keyspaces-full-access",
            "Principal": "*",
            "Action": [
              "cassandra:*",
              "keyspaces:*"
            ],
            "Effect": "Allow",
            "Resource": "*"
          }
        ]
      }

【讨论】:

    【解决方案2】:

    你应该只需要 cassandra

    {
            "Statement": [
              {
                "Sid": "keyspaces-full-access",
                "Principal": "*",
                "Action": [
                  "cassandra:*"
                ],
                "Effect": "Allow",
                "Resource": "*"
              }
            ]
          }
    

    此外,Amazon Keyspaces 会在您账户中的 system.peers 表中填充一个条目,其中包含 VPC 终端节点可用的每个可用区的条目。要在 system.peers 表中查找和存储可用的接口 VPC 终端节点,Amazon Keyspaces 要求您授予用于连接到 Amazon Keyspaces 的 IAM 实体访问权限,以在您的 VPC 中查询终端节点和网络接口信息。

       {
       "Version":"2012-10-17",
       "Statement":[
          {
             "Sid":"ListVPCEndpoints",
             "Effect":"Allow",
             "Action":[
                "ec2:DescribeNetworkInterfaces",
                "ec2:DescribeVpcEndpoints"
             ],
             "Resource":"*"
          }
       ]
    }
    

    详细了解 VPC 端点here

    【讨论】:

      猜你喜欢
      • 2021-08-29
      • 1970-01-01
      • 2021-10-15
      • 2017-03-20
      • 1970-01-01
      • 2021-01-31
      • 1970-01-01
      • 2021-02-03
      • 1970-01-01
      相关资源
      最近更新 更多