Unable to delete an item in aws dynamodb using aws-cli:
Table data in json format:
{
“primaryKeyAttributeName”: {
“S”: “2024-06-17”
},
“sortKeyCreatedOn”: {
“S”: “2024-06-17Txx:xx:xx.xxx”
},
“AttributeName2”: {
“S”: “CLOSED”
},
“AttributeName3”: {
“L”: []
},
“lastUpdated”: {
“S”: “xxxxxxx”
},
“lastUpdatedBy”: {
“S”: “xxxx”
}
}
As per this document https://docs.aws.amazon.com/cli/latest/reference/dynamodb/delete-item.html, tried “Example 1” as below
Command which i used for deleting an item:
aws dynamodb delete-item --table-name table-name --key file://C:/dao/key.json --return-values ALL_OLD --return-consumed-capacity TOTAL --return-item-collection-metrics SIZE
File contents of C:/dao/key.json:
{
“primaryKeyAttributeName”: {“S”: “2024-06-17”},
“AttributeName2”: {“S”: “CLOSED”}
}
Am expecting to delete, but receiving this error:
An error occurred (ValidationException) when calling the DeleteItem operation: The provided key element does not match the schema
Sam is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.