AppSync BatchResolver AssumeRole错误 [英] AppSync BatchResolver AssumeRole Error

查看:70
本文介绍了AppSync BatchResolver AssumeRole错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用新的DynamoDB BatchResolvers写入AppSync解析器中的两个DynamoDB表(当前使用Lambda函数执行此操作)。但是,在查看CloudWatch日志时出现以下权限错误:

I’m trying to use the new DynamoDB BatchResolvers to write to two DynamoDB table in an AppSync resolver (currently using a Lambda function to do this). However, I’m getting the following permission error when looking at the CloudWatch logs:

用户:arn:aws:sts :: 111111111111:假定角色/ appsync-datasource-ddb-xxxxxx-TABLE-ONE / APPSYNC_ASSUME_ROLE无权执行:资源上的dynamodb:BatchWriteItem:arn:aws:dynamodb:us-east-1:111111111111:table / TABLE-TWO(服务:AmazonDynamoDBv2;状态代码:400;错误代码:AccessDeniedException;

我正在使用 TABLE-ONE

I’m using TABLE-ONE as my data source in my resolver.

我添加了 dynamodb:BatchWriteItem dynamodb:BatchGetItem TABLE-ONE 的许可:

{
版本: 2012-10-17,
声明:[
{
Sid: VisualEditor0,
效果:允许,
动作:[
dynamodb:BatchGetItem,
dynamodb:BatchWriteItem,
dynamodb :输入tem,
dynamodb:DeleteItem,
dynamodb:GetItem,
dynamodb:Scan,
dynamodb:Query,
dynamodb: UpdateItem
],
资源:[
arn:aws:dynamodb:us-east-1:111111111111:table / TABLE-ONE,
arn: aws:dynamodb:us-east-1:111111111111:table / TABLE-ONE / *,
arn:aws:dynamodb:us-east-1:111111111111:table / TABLE-TWO,
arn:aws:dynamodb:us-east-1:111111111111:table / TABLE-TWO / *
]
}
]
}

我有另一个解析器,该解析器使用 BatchGetItem 操作,并且在响应中获取空值-更改表的策略访问级别后,固定为空值:

I have another resolver that uses the BatchGetItem operation and was getting null values in my response - changing the table’s policy access level fixed the null values:

但是,选中 BatchWriteItem 的框似乎并不能解决

However, checking the box for BatchWriteItem doesn’t seem to solve the issue either adding the permissions to the data source table’s policy.

我还在AppSync中测试了我的解析器测试功能,所评估的请求和响应按预期工作。

I also tested my resolver test feature in AppSync, the evaluated request and response are working as intended.

我还能在哪里设置两个表之间的BatchWriteItem操作的权限?似乎是在调用用户的假定角色而不是表的角色-我可以'强制'它使用表的角色吗?

Where else could I set the permissions for a BatchWriteItem operation between two tables? It seems like it's invoking the user's assumed-role instead of the table's role - can I 'force' it to use the table's role?

推荐答案

它正在使用您在AppSync控制台中为表配置的角色。请注意,该特定角色应具有appsync作为可信实体。

It is using the role that you have configured for the table in the AppSync console. Note that that particular role, should have appsync as a trusted entity.

或者,如果您在控制台中创建数据源时使用了新角色复选框,则应注意

Or if you use the new role tick box when creating the data source in the console, it should take care of it.

这篇关于AppSync BatchResolver AssumeRole错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆