我目前正在使用 AWS cli 在 DynamoDB 中创建一个表。我正在使用的命令是
aws dynamodb create-table --cli-input-json file://.feature_promotions-dynamodb.json --endpoint-url http://localhost:8000
Run Code Online (Sandbox Code Playgroud)
根据 的文档create-table,我应该能够将计费模式设置为,而PAY_PER_REQUEST不必设置预配置的吞吐量,但每次运行命令时我都会收到以下错误:
An error occurred (ValidationException) when calling the CreateTable operation: No provisioned throughput specified for the table
Run Code Online (Sandbox Code Playgroud)
我awscli昨天升级到
aws-cli/1.16.90 Python/3.7.2 Darwin/18.2.0 botocore/1.12.80
Run Code Online (Sandbox Code Playgroud)
除此之外,我不知道如何解决它。目前我的解决方法是仅创建具有预配置吞吐量的表,然后转到控制台进行更改,但这似乎没有必要。最终,我希望能够在 bash 脚本中运行此命令,而不必稍后修复 AWS 控制台中的表设置。
下面是我在命令中加载的 JSON 文件create-table。"BillingMode": "PAY_PER_REQUEST"属性和值是在之后设置的"AttributeDefinition",我希望它能够正常工作而不会出现任何错误。如果我删除计费模式行,并将以下属性添加到文件中
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
Run Code Online (Sandbox Code Playgroud)
它创建的表没有任何错误。
{
"TableName": "dev.feature_promotions",
"AttributeDefinitions": [
{
"AttributeName": "display_title",
"AttributeType": "S"
},
{
"AttributeName": "end_date",
"AttributeType": …Run Code Online (Sandbox Code Playgroud)