json - 使用 json 文件在本地主机中创建 dynamo db 表
问题描述
我想在 localhost 中创建 dynamodb 表我已经使用这个脚本下载了我的远程 dynamodb 表。
https://github.com/bchew/dynamodump
我从这里的答案中得到的这个脚本。 如何将现有的发电机表模式导出到 json?
我得到了本地机器中所有表的本地备份现在我想在我的 dynamodb 本地系统中创建这些表,因为这个原因我使用这个命令将我的表上传到本地数据库。
sudo aws dynamodb create-table --cli-input-json file:///home/evbooth/Desktop/dynamo/table/dynamodump/dump/admin/schema.json --endpoint-url http://localhost:8000
但我收到这样的错误。
Parameter validation failed:
Missing required parameter in input: "AttributeDefinitions"
Missing required parameter in input: "TableName"
Missing required parameter in input: "KeySchema"
Missing required parameter in input: "ProvisionedThroughput"
Unknown parameter in input: "Table", must be one of: AttributeDefinitions, TableName, KeySchema, LocalSecondaryIndexes, GlobalSecondaryIndexes, ProvisionedThroughput, StreamSpecification, SSESpecification
下载的json文件是这样的。
{
"Table": {
"TableArn": "arn:aws:dynamodb:us-west-2:xxxx:table/admin",
"AttributeDefinitions": [
{
"AttributeName": "userid",
"AttributeType": "S"
}
],
"ProvisionedThroughput": {
"NumberOfDecreasesToday": 0,
"WriteCapacityUnits": 1,
"ReadCapacityUnits": 1
},
"TableSizeBytes": 0,
"TableName": "admin",
"TableStatus": "ACTIVE",
"TableId": "fd21aaab-52fe-4f86-aba6-1cc9a7b17417",
"KeySchema": [
{
"KeyType": "HASH",
"AttributeName": "userid"
}
],
"ItemCount": 0,
"CreationDateTime": 1403367027.739
}
}
我怎样才能解决这个问题?我真的很生气aws对dynamo db也不太了解
解决方案
通过完全删除它,我能够在 DynamoDB 中本地创建表:
"BillingModeSummary": { "BillingMode": "PROVISIONED", "LastUpdateToPayPerRequestDateTime": 0 }
创建表后,我查看了表元信息,奇怪的是它包含以下内容:
"BillingModeSummary": {
"BillingMode": "PROVISIONED",
"LastUpdateToPayPerRequestDateTime": "1970-01-01T00:00:00.000Z"
}
我回去尝试使用如上所示的格式创建表格。然而它失败了。底线只是删除"BillingModeSummary"
并瞧瞧表已创建!:-)
推荐阅读
- c++ - 关于离线崩溃报告的建议
- xamarin.forms - 在 xamarin.forms 中单击按钮时的动态堆栈布局
- c++ - 如何告诉字符串读取 0 而不是中止?
- javascript - react-datepicker 以秒为单位的时间选择
- android - 如何从与其他模块共享的测试模块中读取 json 文件?
- c# - 我们可以在着色器代码中将纹理分成两个相等的部分 - c# openTK
- flutter - Dart - 如何在没有元素的情况下获取 Iterable 元素的`runtimeType`?
- assembly - 编辑或创建链接的 dll 文件
- git - Big git merge - 跨提交拆分分辨率
- .net - 在 CefSharp 的 PDF 查看器中隐藏或禁用下载按钮和打印按钮