Permalink
Newer
100644
38 lines (36 sloc)
731 Bytes
1
const { config, DynamoDB } = require("aws-sdk");
2
3
config.update({ region: "eu-west-1" });
4
const dynamodb = new DynamoDB();
5
6
dynamodb.createTable(
7
{
8
TableName: "td_notes_sdk",
9
AttributeDefinitions: [
10
{
11
AttributeName: "user_id",
12
AttributeType: "S",
13
},
14
{
15
AttributeName: "timestamp",
16
AttributeType: "N",
17
},
18
],
19
KeySchema: [
20
{
21
AttributeName: "user_id",
22
KeyType: "HASH",
23
},
24
{
25
AttributeName: "timestamp",
26
KeyType: "RANGE",
27
},
28
],
29
BillingMode: "PAY_PER_REQUEST",
30
},
31
(err, data) => {
32
if (err) {
33
console.log(err);
34
} else {
35
console.log(JSON.stringify(data, null, 2));
36
}
37
},
38
);