AWS DynamoDB¶
DynamoDB is a no relational database in AWS. This will only cover the part required for the workshop but feel free to refer to the official documentation.
In this workshop, we need a way to store our state, this mean we need the questions and answers of our users in a database so we can publish the results to the chat when the time comes.
To do so, at serverless.yml
we create a table with two items:
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | StandupDynamoDbTable:
Type: 'AWS::DynamoDB::Table'
DeletionPolicy: Retain
Properties:
AttributeDefinitions:
- AttributeName: report_id
AttributeType: S
- AttributeName: report_user_id
AttributeType: S
KeySchema:
- AttributeName: report_id
KeyType: HASH
- AttributeName: report_user_id
KeyType: RANGE
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: ${self:provider.environment.DYNAMODB_TABLE}
|
- report_id: incremental ID of every report
- report_user_id: the user ID that submitted the dialog
After submitting the questions, this table will be updated with:
- answers: dictionary with every question number as a key and the answer as value
When the standup time comes, scheduled.py
will trigger all_reports
functions.