Let's say I have the following AWS SAM resource that creates a DynamoDB table:
EmployeeTable:
Type: AWS::DynamoDB::Table
Properties:
TableName: Employee
AttributeDefinitions:
- AttributeName: EmployeeId
AttributeType: S
- AttributeName: LocationId
AttributeType: S
- AttributeName: DepartmentId
AttributeType: S
KeySchema:
- AttributeName: EmployeeId
KeyType: HASH
GlobalSecondaryIndexes:
- IndexName: Location-index
KeySchema:
- AttributeName: LocationId
KeyType: HASH
Projection:
ProjectionType: ALL
BillingMode: PAY_PER_REQUEST
And I want to interact with DynamoDB through Dynamoose.
In Dynamoose, we have the Model and Schema resources that help us define the shape of our table.
Because I already created the table and the schema (attributes, indexes, etc) within the AWS SAM template, how should I use Dynamoose Schema? How should I use indexes?
Thanks!