-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstatusTable.js
53 lines (51 loc) · 1.94 KB
/
statusTable.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
51
52
53
"use strict";
const aws = require("@pulumi/aws");
const pulumi = require("@pulumi/pulumi");
const statusTable = new aws.dynamodb.Table("runTestID", {
attributes: [{
name: "id",
type: "S"
}],
hashKey: "id",
writeCapacity: 1,
readCapacity: 1
});
const dynamodbTableReadTarget = new aws.appautoscaling.Target("dynamodbTableReadTarget", {
maxCapacity: 10,
minCapacity: 1,
resourceId: pulumi.all([statusTable.name]).apply(([table]) =>`table/${table}`),
scalableDimension: "dynamodb:table:ReadCapacityUnits",
serviceNamespace: "dynamodb",
});
const dynamodbTableReadPolicy = new aws.appautoscaling.Policy("dynamodbTableReadPolicy", {
policyType: "TargetTrackingScaling",
resourceId: dynamodbTableReadTarget.resourceId,
scalableDimension: dynamodbTableReadTarget.scalableDimension,
serviceNamespace: dynamodbTableReadTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "DynamoDBReadCapacityUtilization",
},
targetValue: 70,
},
});
const dynamodbTableWriteTarget = new aws.appautoscaling.Target("dynamodbTableWriteTarget", {
maxCapacity: 10,
minCapacity: 1,
resourceId: pulumi.all([statusTable.name]).apply(([table]) =>`table/${table}`),
scalableDimension: "dynamodb:table:WriteCapacityUnits",
serviceNamespace: "dynamodb",
});
const dynamodbTableWritePolicy = new aws.appautoscaling.Policy("dynamodbTableWritePolicy", {
policyType: "TargetTrackingScaling",
resourceId: dynamodbTableWriteTarget.resourceId,
scalableDimension: dynamodbTableWriteTarget.scalableDimension,
serviceNamespace: dynamodbTableWriteTarget.serviceNamespace,
targetTrackingScalingPolicyConfiguration: {
predefinedMetricSpecification: {
predefinedMetricType: "DynamoDBWriteCapacityUtilization",
},
targetValue: 70,
},
});
module.exports = {statusTable}