尝试使用dynamodb扫描时出现以下错误:
“errorMessage”:“调用扫描操作时发生错误(AccessDeniedException):用户:arn:aws:sts :: 747857903140:assume-role / CodeStarWorker-helpbot-Lambda / awscodestar-helpbot-lambda-FindService-1L7IH17742JLR不是授权执行:dynamodb:扫描资源:arn:aws:dynamodb:us-east-1:747857903140:table / HelpBot“
这是在我的SAM模板中:
FindService:
Type: AWS::Serverless::Function
Properties:
Handler: find_service.handler
Runtime: python3.6
Role:
Fn::ImportValue:
!Join ['-', [!Ref 'ProjectId', !Ref 'AWS::Region', 'LambdaTrustRole']]
Policies:
- AmazonDynamoDBFullAccess
我该怎么做才能解决这个问题?
1 回答
根据this SAM CloudFormation doc:
您需要为包含两组权限的函数定义角色,并将其用作“角色”,或者将LambdaTrustRole的权限添加到“策略” .
后者看起来像这样: