DescribeAlarms
Source:
src/AWS/CloudWatch/DescribeAlarms.ts
Runtime binding for cloudwatch:DescribeAlarms — read the current state
and configuration of the bound alarms. Bind it to one or more
Alarm / CompositeAlarm resources; the alarm names are
injected automatically.
Provide CloudWatch.DescribeAlarmsHttp on the hosting Lambda Function to
satisfy the requirement.
Reading Alarm State
Section titled “Reading Alarm State”const alarm = yield* CloudWatch.Alarm("HighErrors", { MetricName: "Errors", Namespace: "AWS/Lambda", Statistic: "Sum", Period: 60, EvaluationPeriods: 1, Threshold: 1, ComparisonOperator: "GreaterThanOrEqualToThreshold",});
// init — grants cloudwatch:DescribeAlarms on the alarmconst describeAlarms = yield* AWS.CloudWatch.DescribeAlarms(alarm);
// runtimeconst result = yield* describeAlarms();const state = result.MetricAlarms?.[0]?.StateValue; // "OK" | "ALARM" | ...