我在dynamodb中有一张表
aws dynamodb describe-table --table-name work
{
"Table": {
"TableArn": "../work",
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"WriteCapacityUnits": 5,
"ReadCapacityUnits": 5
},
"TableSizeBytes": 0,
"TableName": "work",
"TableStatus": "ACTIVE",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "id"
}
],
"ItemCount": 0,
"CreationDateTime": 1505847222.951
}
我的数据就像
id(P.K)位置
1 location1
2 location1
3 location2
在我的key.json
中{
"location": {"S": "location1"}
}
当我
aws dynamodb delete-item --table-name work --key file://key.json
调用DeleteItem操作时发生错误(ValidationException):提供的键元素与架构不匹配
答案 0 :(得分:1)
{
"id": {"S": "location1"}
}
你的key.json格式错误。
查看文档,
https://docs.aws.amazon.com/cli/latest/reference/dynamodb/delete-item.html