I am new to serverless, AWS and lambda function.
I want to know how to define a sorting key into serverless.yaml file and how we can sort data ASC or DEC order when we fetch the data from DynamoDB table?
I also want to know that suppose I have user table fields like
ID(Primary key)
Fullname(String)
Email(String)
City(String)
State(String)
PhoneNumber(String)
I want to sort in ASC or DEC order on Fullname and email column. So, as per my understanding, I need to define Fullname and email column as sorting key.
Here is my serverless.yaml file
resources:
Resources:
UserDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
-
AttributeName: id
AttributeType: S
KeySchema:
-
AttributeName: id
KeyType: HASH
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: 'user'
So, how can i define multiple sorting keys(Here is Fullname and email) in a table?
In above .yaml
file how can i define Fullname and email as sorting key?
Please help me here. Thanks in advance