forked from ivanbokii/dynochamber
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprovision-tests.js
50 lines (45 loc) · 1.21 KB
/
provision-tests.js
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
var AWS = require("aws-sdk");
var async = require("async");
AWS.config.update({
region: "us-west-2",
endpoint: "http://localhost:8000",
accessKeyId: 'accessKeyId',
secretAccessKey: 'secretAccessKey'
});
module.exports = function(callback) {
var dynamodb = new AWS.DynamoDB();
var movies = {
TableName : "Movies",
KeySchema: [
{ AttributeName: "year", KeyType: "HASH"},
{ AttributeName: "title", KeyType: "RANGE" }
],
AttributeDefinitions: [
{ AttributeName: "year", AttributeType: "N" },
{ AttributeName: "title", AttributeType: "S" }
],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
}
};
var films = {
TableName : "Films",
KeySchema: [
{ AttributeName: "year", KeyType: "HASH"},
{ AttributeName: "title", KeyType: "RANGE" }
],
AttributeDefinitions: [
{ AttributeName: "year", AttributeType: "N" },
{ AttributeName: "title", AttributeType: "S" }
],
ProvisionedThroughput: {
ReadCapacityUnits: 10,
WriteCapacityUnits: 10
}
};
async.parallel([
dynamodb.createTable.bind(dynamodb, movies),
dynamodb.createTable.bind(dynamodb, films)
], callback);
};