I'm trying to create two DynamoDB tables. Both tables have just one partition key, and one has a GSI with a partition key and a sort key. When I try and create the stack in CF, I receive an error on both tables stating that "Property AttributeName cannot be empty.". However, I believe I have provided AttributeName for each of my key values. I have converted the template to JSON as well, yet I get the same error. Where am I going wrong? Please note that this is not the complete template, only the part that is causing an error. Thanks very much in advance!
YAML config:
DynamoDBTable:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
-
AttributeName: "eventName"
AttributeType: "S"
TableName: "BlockCursorTable"
Tags:
-
Key: "project"
Value: "flow-event-monitor"
KeySchema:
-
AttributeName: "eventName"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TimeToLiveSpecification:
Enabled: false
DynamoDBTable2:
Type: "AWS::DynamoDB::Table"
Properties:
AttributeDefinitions:
-
AttributeName: "listingResourceID"
AttributeType: "N"
-
AttributeName: "staticKey"
AttributeType: "N"
-
AttributeName: "timestamp"
AttributeType: "S"
TableName: "ListingTable"
Tags:
-
Key: "project"
Value: "flow-event-monitor"
KeySchema:
-
AttributeName: "listingResourceID"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
GlobalSecondaryIndexes:
-
IndexName: "staticKey-timestamp-index"
KeySchema:
-
AttributeName: "staticKey"
KeyType: "HASH"
-
AttributeName: "timestamp"
KeyType: "RANGE"
Projection:
ProjectionType: "ALL"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TimeToLiveSpecification:
Enabled: false
Equivalent JSON template:
{
"DynamoDBTable": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "eventName",
"AttributeType": "S"
}
],
"TableName": "BlockCursorTable",
"Tags": [
{
"Key": "project",
"Value": "flow-event-monitor"
}
],
"KeySchema": [
{
"AttributeName": "eventName",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"TimeToLiveSpecification": {
"Enabled": false
}
}
},
"DynamoDBTable2": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "listingResourceID",
"AttributeType": "N"
},
{
"AttributeName": "staticKey",
"AttributeType": "N"
},
{
"AttributeName": "timestamp",
"AttributeType": "S"
}
],
"TableName": "ListingTable",
"Tags": [
{
"Key": "project",
"Value": "flow-event-monitor"
}
],
"KeySchema": [
{
"AttributeName": "listingResourceID",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
},
"GlobalSecondaryIndexes": [
{
"IndexName": "staticKey-timestamp-index",
"KeySchema": [
{
"AttributeName": "staticKey",
"KeyType": "HASH"
},
{
"AttributeName": "timestamp",
"KeyType": "RANGE"
}
],
"Projection": {
"ProjectionType": "ALL"
},
"ProvisionedThroughput": {
"ReadCapacityUnits": 1,
"WriteCapacityUnits": 1
}
}
],
"TimeToLiveSpecification": {
"Enabled": false
}
}
}
}