amazon-web-services - 使用 CLI 时如何解决 AWS DynamoDB 中的 (ValidationException) 问题?
问题描述
我刚刚在 CLI 中学习 AWS DynamoDB。我是专门put-item
使用 command 执行的
aws dynamodb put-item --table-name new --item file://item.json
。我已经成功配置了 IAM 凭证,我还可以使用以下方法获得回复
aws dynamodb list-tables
:
{
"TableNames": [
"new",
"test"
]
}
错误:
我特别是这个错误:An error occurred (ValidationException) when calling the PutItem operation: One or more parameter values were invalid: Missing the key newid in the item
谁能指导我如何摆脱这个并修复这个错误?
解决方案
好的,我是提出这个问题的人,感谢@krishna_mee2004提示我的问题。主要问题是我已将分区键指定为test_id
并且我将其用作user_id
.
我以前的格式item.json
是
{
"user_id":{"S":"123add"},
"ForumName": {"S": "Amazon DynamoDB"},
"Subject": {"S": "New discussion thread"},
"Message": {"S": "First post in this thread"},
"LastPostedBy": {"S": "fred@example.com"},
"LastPostDateTime": {"S": "201603190422"}
}
但我只是替换user_id
为test_id
:
{
"test_id":{"S":"123add"},
"ForumName": {"S": "Amazon DynamoDB"},
"Subject": {"S": "New discussion thread"},
"Message": {"S": "First post in this thread"},
"LastPostedBy": {"S": "fred@example.com"},
"LastPostDateTime": {"S": "201603190422"}
}
这是我的 AWS DynamoDB 表的实际分区键,瞧,它起作用了:
我成功创建了一个表列表:
推荐阅读
- c# - WPF 单击按钮并将文本块更新为新问题
- node.js - 如何从 MongoDB 和 Node.js 中匹配用户输入的文档中获取价值
- .net - VB.Net 保存按钮未将数据添加到文本文件
- mongodb - 如何使用 MongoDB 实现 Redis 缓存?
- android - 重复的 jar 条目 - android
- c++ - 在没有新运算符的情况下细分四叉树
- java - 使用 Mockito 在 PersonServiceTest 中编写单元测试
- r - 如何调整 ggplot2 中 x 轴标签的水平位置(对于连续 x 轴)
- aws-lambda - 每个设备应将 StateReport/ChangeReport 发送到哪个事件端点?
- android - V-Play 生成的 APK 太大