Как я могу создать таблицу DynamoDB с помощью Node SDK и указать «по требованию» в качестве ProvisionedThroughput
? Я получаю эту ошибку, когда опускаю опцию ProvisionedThroughput
:
ValidationException: One or more parameter values were invalid: ReadCapacityUnits and WriteCapacityUnits must both be specified when BillingMode is PROVISIONED
at Request.extractError (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/protocol/json.js:51:27)
at Request.callListeners (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/james/projects/ears/server/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/james/projects/ears/server/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/james/projects/ears/server/node_modules/aws-sdk/lib/request.js:38:9)
Вот мой код, который пытается создать таблицу:
await dynamodb
.createTable({
TableName: `${studyName}StudyCodeDB`,
AttributeDefinitions: [
{
AttributeName: 'studyCode',
AttributeType: 'S',
},
{
AttributeName: 'studyCodeCreationDate',
AttributeType: 'N',
},
],
KeySchema: [
{
AttributeName: 'studyCode',
KeyType: 'HASH',
},
{
AttributeName: 'studyCodeCreationDate',
KeyType: 'RANGE',
},
],
})
.promise();