I've created an ECS cluster like so:
this.cluster = new ecs.Cluster(this, 'Cluster', {
containerInsights: true,
vpc: ec2.Vpc.fromLookup(this, props.stage + 'Vpc', {isDefault: false})
});
I want to create a CW alarm based off my cluser like so:
const CPUHigh = new cw.Alarm(this, "CPUHigh", {
metric: this.cluster.metric("CPUUtilized"),
threshold: 50,
evaluationPeriods: 3,
period: cdk.Duration.seconds(60),
comparisonOperator: cw.ComparisonOperator.GREATER_THAN_THRESHOLD
})
But even though the metric matches the one created by Container Insights, it seems like it can't be referenced this way.
Does anyone know the way its supposed to be referenced?