简体   繁体   English

Kinesis 使用者在使用 KCL 时需要哪些 IAM 权限?

[英]What IAM permissions does a Kinesis Consumer need when using KCL?

I have a Kinesis consumer I wrote using the Kinesis Client Library (KCL).我有一个使用 Kinesis Client Library (KCL) 编写的 Kinesis 消费者。 This consumer is running under an assumed IAM role.此使用者在假定的 IAM 角色下运行。

I've read from the documentation that:我从文档中读到:

The KCL creates a DynamoDB table with the application name and uses the table to maintain state information (such as checkpoints and worker-shard mapping) for the application. KCL 使用应用程序名称创建一个 DynamoDB 表,并使用该表来维护应用程序的 state 信息(例如检查点和工作分片映射)。 Each application has its own DynamoDB table.每个应用程序都有自己的 DynamoDB 表。 For more information, see Tracking Amazon Kinesis Data Streams Application State.有关更多信息,请参阅跟踪 Amazon Kinesis Data Streams 应用程序 State。

Sure, I need to add the dynamodb:CreateTable permission to my IAM role.当然,我需要将dynamodb:CreateTable权限添加到我的 IAM 角色。 However, I'm getting errors for other things, (eg dynamodb:DescribeTable ).但是,我在其他方面遇到了错误(例如dynamodb:DescribeTable )。

Is there a list of all DynamoDB operations my KCL consumer needs access to?是否有我的 KCL 使用者需要访问的所有 DynamoDB 操作的列表? The documentation seems to be lacking and I'd rather have an authoritative list than keep trying to run my application.似乎缺少文档,我宁愿拥有一个权威列表,也不愿继续尝试运行我的应用程序。

This should be the set of permissions you need.这应该是您需要的一组权限。 The table name is provided by the client code, defaults to appName but can be overridden in the ConfigsBuilder :表名由客户端代码提供,默认为appName但可以在ConfigsBuilder中覆盖:

          - Effect: Allow
            Action:
              - dynamodb:CreateTable
              - dynamodb:DescribeTable
              - dynamodb:Scan
              - dynamodb:PutItem
              - dynamodb:GetItem
              - dynamodb:UpdateItem
              - dynamodb:DeleteItem
            Resource:
              - !Join ["", ["arn:aws:dynamodb:*:", !Ref 'AWS::AccountId', ":table/*"]]

I also had the same issue, was able to resolve issue after setting this policy, there should be a proper permission enabled to access Kinesis also我也遇到了同样的问题,设置此策略后能够解决问题,还应该启用适当的权限来访问 Kinesis

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "kinesis:Get*",
                "kinesis:DescribeStream",
                "kinesis:ListShards"
            ],
            "Resource": [
                "arn:aws:kinesis:ap-south-1:ACCOUNT_ID:stream/STREAM_NAME"
            ]
        },
        {
            "Effect": "Allow",
            "Action": [
                "kinesis:ListStreams"
            ],
            "Resource": [
                "arn:aws:kinesis:ap-south-1:ACCOUNT_ID:stream/STREAM_NAME"
            ]
        },
        {
            "Sid": "SpecificTable",
            "Effect": "Allow",
            "Action": [
                "dynamodb:BatchGet*",
                "dynamodb:DescribeStream",
                "dynamodb:DescribeTable",
                "dynamodb:Get*",
                "dynamodb:Query",
                "dynamodb:Scan",
                "dynamodb:BatchWrite*",
                "dynamodb:CreateTable",
                "dynamodb:Delete*",
                "dynamodb:Update*",
                "dynamodb:PutItem"
            ],
            "Resource": "arn:aws:dynamodb:ap-south-1:ACCOUNT_ID:table/TABLE_NAME*"
        }
    ]
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM