Getting an issue during sam deploy saying that ProvisionedThroughput cannot be empty.
Here's the table defined in my template.yml
GameRoomTable:
Type: AWS::DynamoDB::Table
Properties:
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
- AttributeName: "connection_id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
- AttributeName: "connection_id"
KeyType: "RANGE"
GlobalSecondaryIndexes:
- IndexName: connection-idx
KeySchema:
- AttributeName: "connection_id"
KeyType: "HASH"
Projection:
ProjectionType: "ALL"
Please provide command output with --debug flag set.
Successful deployment
sam --version:@raymonstah This looks like an issue related to the SAM Spec. I am going to transfer this over to that repo for guidance/help.
I'm able to reproduce this error when specifying BillingMode as PAY_PER_REQUEST. Adding in ProvisionThroughput as the error requests makes no difference. YAML code formatting doesn't carry over:
TestTable:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: 'PAY_PER_REQUEST'
ProvisionedThroughput:
ReadCapacityUnits: 0
WriteCapacityUnits: 0
KeySchema:
AttributeName: record_id
KeyType: HASH
KeySchema:
AttributeName: sort_id
KeyType: RANGE
TableName: "test-table"
Is there a workaround or do we need to just manually create tables for now?
I dont know if it would be useful information but I can create on demand dynamodb table with aws cloudformation cli using following template values
Transform: AWS::Serverless-2016-10-31
Table:
Type: AWS::DynamoDB::Table
Properties:
BillingMode: PAY_PER_REQUEST
AttributeDefinitions:
- AttributeName: connectionId
AttributeType: S
KeySchema:
- AttributeName: connectionId
KeyType: HASH
SSESpecification:
SSEEnabled: false
TableName: !Ref TableName
I am having this same error. Whenever I add a "GlobalSecondaryIndexes" property to my AWS::DynamoDB::Table definition, I get "ProvisionedThroughput cannot be empty" on deploy. Any status update on this?
Same issue here as @mh-holdrent if I include GlobalSecondaryIndexes I get the ProvisionedThroughput cannot be empty error on deploy. Same table definition works if I switch to LocalSecondaryIndexes, but LSI won't satisfy my use case
I was able to resolve the issue for my use case. Per AWS Documentation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html) a GSI itself _also_ requires a ProvisionedThroughput section in addition to the table itself requiring a ProvisioinedThroughput section. So to address the OPs issue, you'd update the table definition to:
GameRoomTable:
Type: AWS::DynamoDB::Table
Properties:
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
AttributeDefinitions:
- AttributeName: "id"
AttributeType: "S"
- AttributeName: "connection_id"
AttributeType: "S"
KeySchema:
- AttributeName: "id"
KeyType: "HASH"
- AttributeName: "connection_id"
KeyType: "RANGE"
GlobalSecondaryIndexes:
- IndexName: connection-idx
KeySchema:
- AttributeName: "connection_id"
KeyType: "HASH"
Projection:
ProjectionType: "ALL"
ProvisionedThroughput:
ReadCapacityUnits: 5
WriteCapacityUnits: 5
And you should be all set. Hope this helps!
Yes, I discovered the same thing shortly after I made this post. Thanks for confirming. Perhaps the error message should be updated to make it clear as to which section it is complaining needs ProvisionedThroughput defined?
I found the same issue. I was trying to add the GSI's to the tables without providing the ProvisionedThroughput as the AWS Doc suggest it's not required.
Most helpful comment
I was able to resolve the issue for my use case. Per AWS Documentation (https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-dynamodb-gsi.html) a GSI itself _also_ requires a ProvisionedThroughput section in addition to the table itself requiring a ProvisioinedThroughput section. So to address the OPs issue, you'd update the table definition to:
And you should be all set. Hope this helps!