从 DynamoDB 到 elasticsearch 的流数据失败 "no permissions for [indices:data/write/bulk]"

streaming data from DynamoDB to elasticsearch is failing with "no permissions for [indices:data/write/bulk]"

我正在尝试将数据从 DynamoDB 流式传输到 ElasticSearch。我已经检查了 AWS 和其他一些在线资源的文档,但我遇到了安全问题。所以我正在使用 lambda 函数,从 DynamoDB 检索数据的过程很好,但是当我尝试写回 ElasticSearch 时出现错误:

"no permissions for [indices:data/write/bulk] and User [name=arn:aws:iam::account number:role/dynamodb_to_es, backend_roles=[arn:aws:iam::account number:role/dynamodb_to_es], requestedTenant=null]"

这是我的 Lambda 函数。我意识到它总是会因为“_bulk”扩展名而失败。谢谢!!

我的 Lambda 函数: https://github.com/YassineRjl/Lambda-Func---DynamoDB-to-ElasticSearch/blob/master/lambda_func.py

我的 IAM 角色:

我找到了解决方案。在创建 ES 实例期间,确保取消选择 "fine-grained access control" 并为了 Https 而避免使用 VPC,然后在角色上,在 IAM 上创建一个角色,并在实例设置期间将 ARN 复制粘贴到 ES 仪表板中

您不必禁用“细粒度访问控制”。相反,您可以编辑角色映射。

详细信息和步骤请查看:

https://aws.amazon.com/tr/premiumsupport/knowledge-center/es-troubleshoot-cloudwatch-logs/

“启用细粒度访问控制后,我无法将我的 CloudWatch 日志组流式传输到 Amazon ES 域。”主题。

您应该将您的用户映射到角色:kibana_user,它定义了访问索引的基本权限。

如果你像我一样从 Google 找到这个,这适用于我的用例:

  1. 打开您的 Kibana 控制面板 (https://your-domain-somerandomstring.us-east-1.es.amazonaws.com/us-east-1.es.amazonaws.com/_plugin/kibana/app/opendistro_security#/roles/view/all_access/mapuser)
  2. 在左侧导航中导航到安全性
  3. Select 角色
  4. Select 您希望将用户附加到的角色(在上面的示例中,它是“all_access”)
  5. 从错误日志中添加您的用户名,或使用 ARN 作为您的用户名(我的与我连接的实例相关联的实例配置文件相关)