-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreateTable.js
More file actions
37 lines (34 loc) · 856 Bytes
/
createTable.js
File metadata and controls
37 lines (34 loc) · 856 Bytes
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
import { CreateTableCommand } from "@aws-sdk/client-dynamodb";
import { ddbClient } from "./dbconfig.js";
export const params = {
AttributeDefinitions: [
{
AttributeName: "ID", //ATTRIBUTE_NAME_1
AttributeType: "N", //ATTRIBUTE_TYPE
},
],
KeySchema: [
{
AttributeName: "ID", //ATTRIBUTE_NAME_1
KeyType: "HASH",
},
],
ProvisionedThroughput: {
ReadCapacityUnits: 1,
WriteCapacityUnits: 1,
},
TableName: "TEST_TABLE", //TABLE_NAME
StreamSpecification: {
StreamEnabled: false,
},
};
export const run = async () => {
try {
const data = await ddbClient.send(new CreateTableCommand(params));
console.log("Table Created", data);
return data;
} catch (err) {
console.log("Error", err);
}
};
// run();