dcl-ops-lib 6.8.1 → 6.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/createFargateTask.d.ts +2 -2
- package/createFargateTask.js +37 -34
- package/package.json +1 -1
package/createFargateTask.d.ts
CHANGED
|
@@ -58,7 +58,7 @@ export type FargateTaskOptions = {
|
|
|
58
58
|
maxCapacity: number;
|
|
59
59
|
metricName: string;
|
|
60
60
|
targetValue: number;
|
|
61
|
-
|
|
61
|
+
metricDimensionValue: pulumi.Output<string>;
|
|
62
62
|
statistic?: "Average" | "Minimum" | "Maximum";
|
|
63
63
|
scaleOutCooldown?: number;
|
|
64
64
|
scaleInCooldown?: number;
|
|
@@ -117,7 +117,7 @@ export type InternalServiceOptions = {
|
|
|
117
117
|
maxCapacity: number;
|
|
118
118
|
metricName: string;
|
|
119
119
|
targetValue: number;
|
|
120
|
-
|
|
120
|
+
metricDimensionValue: pulumi.Output<string>;
|
|
121
121
|
statistic?: "Average" | "Minimum" | "Maximum";
|
|
122
122
|
scaleOutCooldown?: number;
|
|
123
123
|
scaleInCooldown?: number;
|
package/createFargateTask.js
CHANGED
|
@@ -372,40 +372,43 @@ function createInternalService(config) {
|
|
|
372
372
|
}
|
|
373
373
|
function setAutoscaling(service, config) {
|
|
374
374
|
const taskUniqueIdentifier = `${service.name}-${domain_1.env}`;
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
375
|
+
// resolve the Output<string> before using it
|
|
376
|
+
config.metricDimensionValue.apply(metricValue => {
|
|
377
|
+
const ecsTarget = new aws.appautoscaling.Target(`ecs-target-${taskUniqueIdentifier}`, {
|
|
378
|
+
maxCapacity: config.maxCapacity,
|
|
379
|
+
minCapacity: config.desiredCount,
|
|
380
|
+
resourceId: pulumi.interpolate `service/${service.cluster}/${service.name}`,
|
|
381
|
+
scalableDimension: "ecs:service:DesiredCount",
|
|
382
|
+
serviceNamespace: "ecs",
|
|
383
|
+
});
|
|
384
|
+
const CSM_ApproximateNumberOfMessagesVisible = {
|
|
385
|
+
metricName: config.metricName,
|
|
386
|
+
namespace: "AWS/SQS",
|
|
387
|
+
dimensions: [
|
|
388
|
+
{
|
|
389
|
+
name: "QueueName",
|
|
390
|
+
value: metricValue,
|
|
391
|
+
},
|
|
392
|
+
],
|
|
393
|
+
statistic: config.statistic,
|
|
394
|
+
unit: "Count",
|
|
395
|
+
};
|
|
396
|
+
let TTS_CustomizedMetricSpecification = undefined;
|
|
397
|
+
if (config.metricName === "ApproximateNumberOfMessagesVisible") {
|
|
398
|
+
TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
|
|
399
|
+
}
|
|
400
|
+
return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
|
|
401
|
+
policyType: "TargetTrackingScaling",
|
|
402
|
+
resourceId: ecsTarget.resourceId,
|
|
403
|
+
scalableDimension: ecsTarget.scalableDimension,
|
|
404
|
+
serviceNamespace: ecsTarget.serviceNamespace,
|
|
405
|
+
targetTrackingScalingPolicyConfiguration: {
|
|
406
|
+
targetValue: config.targetValue,
|
|
407
|
+
customizedMetricSpecification: TTS_CustomizedMetricSpecification,
|
|
408
|
+
scaleOutCooldown: config.scaleOutCooldown,
|
|
409
|
+
scaleInCooldown: config.scaleInCooldown,
|
|
389
410
|
},
|
|
390
|
-
]
|
|
391
|
-
|
|
392
|
-
unit: "Count",
|
|
393
|
-
};
|
|
394
|
-
let TTS_CustomizedMetricSpecification = undefined;
|
|
395
|
-
if (config.metricName === "ApproximateNumberOfMessagesVisible") {
|
|
396
|
-
TTS_CustomizedMetricSpecification = CSM_ApproximateNumberOfMessagesVisible;
|
|
397
|
-
}
|
|
398
|
-
return new aws.appautoscaling.Policy(`ecs-autoscaling-policy-${taskUniqueIdentifier}`, {
|
|
399
|
-
policyType: "TargetTrackingScaling",
|
|
400
|
-
resourceId: ecsTarget.resourceId,
|
|
401
|
-
scalableDimension: ecsTarget.scalableDimension,
|
|
402
|
-
serviceNamespace: ecsTarget.serviceNamespace,
|
|
403
|
-
targetTrackingScalingPolicyConfiguration: {
|
|
404
|
-
targetValue: config.targetValue,
|
|
405
|
-
customizedMetricSpecification: TTS_CustomizedMetricSpecification,
|
|
406
|
-
scaleOutCooldown: config.scaleOutCooldown,
|
|
407
|
-
scaleInCooldown: config.scaleInCooldown,
|
|
408
|
-
},
|
|
409
|
-
}, { dependsOn: [ecsTarget] });
|
|
411
|
+
}, { dependsOn: [ecsTarget] });
|
|
412
|
+
});
|
|
410
413
|
}
|
|
411
414
|
//# sourceMappingURL=createFargateTask.js.map
|