class AtLeastThreshold
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CloudWatch.AtLeastThreshold |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscloudwatch#AtLeastThreshold |
Java | software.amazon.awscdk.services.cloudwatch.AtLeastThreshold |
Python | aws_cdk.aws_cloudwatch.AtLeastThreshold |
TypeScript (source) | aws-cdk-lib » aws_cloudwatch » AtLeastThreshold |
Threshold configuration for the AT_LEAST composite alarm rule expression.
Use AtLeastThreshold.count() for an absolute number or
AtLeastThreshold.percentage() for a percentage-based threshold.
Example
declare const alarm1: cloudwatch.Alarm;
declare const alarm2: cloudwatch.Alarm;
declare const alarm3: cloudwatch.Alarm;
declare const alarm4: cloudwatch.Alarm;
const alarmRule = cloudwatch.AlarmRule.anyOf(
cloudwatch.AlarmRule.allOf(
cloudwatch.AlarmRule.anyOf(
alarm1,
cloudwatch.AlarmRule.fromAlarm(alarm2, cloudwatch.AlarmState.OK),
alarm3,
),
cloudwatch.AlarmRule.not(cloudwatch.AlarmRule.fromAlarm(alarm4, cloudwatch.AlarmState.INSUFFICIENT_DATA)),
// AT_LEAST with count: at least 2 of these alarms must be in ALARM state
cloudwatch.AlarmRule.atLeast(cloudwatch.AlarmState.ALARM, {
operands: [alarm1, alarm2, alarm3],
threshold: cloudwatch.AtLeastThreshold.count(2),
}),
// AT_LEAST with percentage and NOT: at least 60% must NOT be in OK state
cloudwatch.AlarmRule.atLeastNot(cloudwatch.AlarmState.OK, {
operands: [alarm1, alarm2, alarm3],
threshold: cloudwatch.AtLeastThreshold.percentage(60),
}),
),
cloudwatch.AlarmRule.fromBoolean(false),
);
new cloudwatch.CompositeAlarm(this, 'MyAwesomeCompositeAlarm', {
alarmRule,
});
Initializer
new AtLeastThreshold()
Methods
| Name | Description |
|---|---|
| static count(count) | Creates a count-based threshold for the AT_LEAST expression. |
| static percentage(percentage) | Creates a percentage-based threshold for the AT_LEAST expression. |
static count(count)
public static count(count: number): AtLeastThreshold
Parameters
- count
number— the minimum number of alarms that must be in the specified state.
Returns
Creates a count-based threshold for the AT_LEAST expression.
The count must be a positive integer between 1 and the number of operands.
static percentage(percentage)
public static percentage(percentage: number): AtLeastThreshold
Parameters
- percentage
number— the minimum percentage of alarms that must be in the specified state.
Returns
Creates a percentage-based threshold for the AT_LEAST expression.
The percentage must be an integer between 1 and 100.

.NET
Go
Java
Python
TypeScript (