I'm building a cloud watch alarm to send an email when a lambda function is not called in a period of 5 minutes
CloudWatchAlarm:
Type: AWS::CloudWatch::Alarm
Properties:
AlarmActions:
- !Ref SNSTopic
AlarmDescription: Send email if lambda function was not called within 5 minutes
Dimensions:
-
Name: "FunctionName"
Value: "my-lambda"
ComparisonOperator: LessThanThreshold
EvaluationPeriods: 1
MetricName: Invocations
Namespace: AWS/Lambda
Period: 300
Statistic: Sum
Threshold: 1
TreatMissingData: breaching
DatapointsToAlarm: 1
So, when the function is called, invocation metric goes to one and the alarm enter in OK state. But, when 5 minutes is passed without call the function, the alarm does not come back to ALARM state. Actually it takes like 15 minutes to go to ALARM state.
If I put a minor period, it does take less time to come back to ALARM state. I don't understand how period really works.
Does anybody know if this kind of configuration is really possible in Cloud Watch Alarm? How should I determine period and evaluation period to get the email in exactly 5 minutes ?