我正在关注这一点
tutorial from Medium.com
使用AWS创建URL缩短器。
我已经设置好了整个程序,但是在第一次测试中,当我试图从Lambda获取DynamoDB项目时,遇到了一个权限错误。
如本教程所述,Lambda在特定rol下运行。rol已附上下一项政策:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"dynamodb:PutItem",
"dynamodb:DeleteItem",
"dynamodb:GetItem",
"dynamodb:Query",
"dynamodb:UpdateItem"
],
"Resource": "arn:aws:dynamodb:eu-west-3:922842442607:table/lambda-dynamodb-url-shortener"
}
]
}
然而,正如我之前所说,我得到了这个错误:
[ERROR] ClientError: An error occurred (AccessDeniedException) when calling the GetItem operation: User: arn:aws:sts::***:assumed-role/lambda-dynamodb-url-shortener-role/url-shortener-create is not authorized to perform: dynamodb:GetItem on resource: arn:aws:dynamodb:eu-west-3:***:table/url-shortener-table
当我检查IAM策略模拟器时,我可以看到rol具有上述策略:
但是,正如预期的那样,考虑到这个错误,我在尝试使用角色模拟对DynamoDB的访问时遇到了这个错误:
有线索吗?:(