-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdynamoDb.ts
53 lines (53 loc) · 1.26 KB
/
dynamoDb.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**
* AWS DynamoDB table declaration for storing todo Items
*/
const TodosTable = {
Type: "AWS::DynamoDB::Table",
Properties: {
TableName: "${self:provider.environment.TODOS_TABLE}",
AttributeDefinitions: [
{
AttributeName: "userId",
AttributeType: "S",
},
{
AttributeName: "timestamp",
AttributeType: "S",
},
{
AttributeName: "todoId",
AttributeType: "S",
},
],
KeySchema: [
{
AttributeName: "userId",
KeyType: "HASH",
},
{
AttributeName: "timestamp",
KeyType: "RANGE",
},
],
BillingMode: "PAY_PER_REQUEST",
LocalSecondaryIndexes: [
{
IndexName: "${self:provider.environment.TODO_ID_INDEX}",
KeySchema: [
{
AttributeName: "userId",
KeyType: "HASH"
},
{
AttributeName: "todoId",
KeyType: "RANGE"
}
],
Projection: {
ProjectionType: "ALL",
}
}
]
},
};
export {TodosTable}