I try to apply a dynamodb in my serverless aws lambda. My file is like:
resources:
Resources:
StoreDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: id
AttributeType: S
- AttributeName: lat
AttributeType: N
- AttributeName: lng
AttributeType: N
KeySchema:
- AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.TableStore}
I try to apply lat and lng as attributes of storeTable, just the attribute not key Schema, but every store element should have these attributes.
But there is error:
An error occurred: StoreDynamoDbTable - Property AttributeDefinitions is inconsistent with the KeySchema of the table and the secondary indexes.
How to make lat and lng just mast attribute,not key element for index?