I keep getting the error:
An error occurred: ResponsesTable - One or more parameter values were invalid: Both ReadCapacityUnits and WriteCapacityUnits must be specified for index: TaskIdIndex (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException
Using the following table definition:
ResponsesTable:
Type: AWS::DynamoDB::Table
DeletionPolicy: Retain
Properties:
TableName: ${self:provider.environment.RESPONSES_TABLE}
BillingMode: PAY_PER_REQUEST
KeySchema:
- AttributeName: responseId
KeyType: HASH
- AttributeName: taskId
KeyType: RANGE
AttributeDefinitions:
- AttributeName: responseId
AttributeType: S
- AttributeName: taskId
AttributeType: S
GlobalSecondaryIndexes:
- IndexName: TaskIdIndex
KeySchema:
- KeyType: HASH
AttributeName: taskId
Projection:
ProjectionType: ALL
StreamSpecification:
StreamViewType: NEW_AND_OLD_IMAGES
I can get around this by manually editing the table using the console but it kind of defeats the purpose of “infrastructure as code”.
Any ideas?