You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

通过Docker部署LocalStack后,导入DynamoDB表失败求助

解决LocalStack导入DynamoDB表结构的参数验证错误

问题根源在于aws dynamodb describe-table导出的JSON结构和create-table要求的结构不匹配:

  • describe-table的输出会把所有表配置嵌套在Table字段下
  • create-table要求AttributeDefinitions、TableName、KeySchema等参数直接处于JSON顶层,因此CLI会提示找不到必填参数,同时识别到多余的Table参数报错。

修复步骤

方法1:用jq直接提取正确结构(推荐)

执行导出命令时,通过jq过滤出Table字段内的内容:

aws dynamodb describe-table --table-name tableName --profile dev --region ap-southeast-2 | jq '.Table' > table.json

方法2:手动编辑JSON文件

打开导出的table.json,删除外层的{"Table":和对应的闭合大括号,只保留内部的表配置对象。

修正命令中的拼写错误

注意你执行create-table时的region参数拼写错误:ap-sountheast-2应该改为ap-southeast-2,修正后的命令:

aws dynamodb create-table --endpoint-url http://localhost:4566 --region ap-southeast-2 --cli-input-json file://table.json

内容的提问来源于stack exchange,提问作者Odinovsky

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 17:17:33