From a243a18d09df55981fd6ce19a0efc213180bb003 Mon Sep 17 00:00:00 2001 From: Dev Singh Date: Wed, 11 Oct 2023 11:53:38 -0500 Subject: [PATCH] add alarms to resume-book api gw --- cloudformation/lambda.yml | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/cloudformation/lambda.yml b/cloudformation/lambda.yml index 82056b6..345535b 100644 --- a/cloudformation/lambda.yml +++ b/cloudformation/lambda.yml @@ -221,6 +221,44 @@ Resources: CertificateArn: !Ref ApiCertificateArn StageName: default + ResumeBookApiGatewayLatencyAlarm: + Type: 'AWS::CloudWatch::Alarm' + Condition: IsProd + Properties: + AlarmName: !Sub '${ResumeBookApiGWName}-latency-alarm' + AlarmDescription: !Sub 'Alarm if ${ResumeBookApiGWName} API gateway latency is > 2s.' + Namespace: 'AWS/ApiGateway' + MetricName: 'Latency' + Statistic: 'Average' + Period: '60' + EvaluationPeriods: '1' + ComparisonOperator: 'GreaterThanThreshold' + Threshold: '3000' + AlarmActions: + - !Ref AlertSNSArn + Dimensions: + - Name: 'ApiName' + Value: !Ref ResumeBookApiGWName + + ResumeBookApiGateway5XXErrorAlarm: + Type: 'AWS::CloudWatch::Alarm' + Condition: IsProd + Properties: + AlarmName: !Sub '${ResumeBookApiGWName}-5XX-alarm' + AlarmDescription: !Sub 'Alarm if ${ResumeBookApiGWName} API gateway 5XX errors are detected.' + Namespace: 'AWS/ApiGateway' + MetricName: '5XXError' + Statistic: 'Average' + Period: '60' + EvaluationPeriods: '1' + ComparisonOperator: 'GreaterThanThreshold' + Threshold: '2' + AlarmActions: + - !Ref AlertSNSArn + Dimensions: + - Name: 'ApiName' + Value: !Ref ResumeBookApiGWName + AadAuthorizerPermission: Type: AWS::Lambda::Permission Properties: