![](/img/trans.png)
[英]DynamoDb update item only if new attribute is greater than existing one
[英]Amazon DynamoDB & IAM - Allow update-item to change a single attribute
描述:
我有一個包含 50 個項目的表,每個項目至少有三個屬性Name
、 Age
和E-mail
。
用戶應該能夠:
對特定項目的Name
執行update
。
對所有項目的屬性執行以下操作:
我試過的:
我在 IAM 中使用了這個策略:
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "UserNameUpdate",
"Effect": "Allow",
"Action": "dynamodb:UpdateItem",
"Resource": "arn:aws:dynamodb:<region>:<account>:table/<tableName>",
"Condition": {
"StringEquals": {
"dynamodb:ReturnValues": [
"NONE",
"UPDATED_OLD",
"UPDATED_NEW"
]
},
"ForAllValues:StringLike": {
"dynamodb:Attributes": "Name"
}
}
},
{
"Sid": "GetAll",
"Effect": "Allow",
"Action": [
"dynamodb:BatchGetItem",
"dynamodb:ConditionCheckItem",
"dynamodb:DescribeTable",
"dynamodb:GetItem",
"dynamodb:Scan",
"dynamodb:ListTagsOfResource",
"dynamodb:Query"
],
"Resource": "arn:aws:dynamodb:<region>:<account>:table/<tableName>"
}
]
}
結果:
AccessDeniedException
。 我不太了解 IAM 規則,尤其是Condition
部分😕。 任何幫助將不勝感激。
Name
是 DynamoDB 中的保留字。 也許那是你的問題?
我認為需要一組值:
"ForAllValues:StringLike": {
"dynamodb:Attributes": ["Name"]
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.