diff --git a/cloudformation.yaml b/cloudformation.yaml index 2f7d8a427..81bee6264 100644 --- a/cloudformation.yaml +++ b/cloudformation.yaml @@ -790,3 +790,36 @@ Resources: - !Ref 'TopicSendEmail' InsufficientDataActions: - !Ref 'TopicSendEmail' + UnsubscribeAllInactivityAlarm: + Type: AWS::CloudWatch::Alarm + Condition: IsProd + Properties: + AlarmName: !Sub + - '${Priority} - ${App} ${Stage} has had successful no unsubscribe all from email clients in the last hour' + - Priority: !FindInMap [StageVariables, AlarmPriorities, P2] + AlarmDescription: 'No one has successfully unsubscribed all from email clients in the last hour.' + Metrics: + - Id: totalUnsubscribeAllCount + Expression: unsubscribeAllCount + Label: 'Total unsubscribe all' + - Id: unsubscribeAllCount + MetricStat: + Metric: + Namespace: Gateway + MetricName: 'UnsubscribeAll::Success' + Dimensions: + - Name: Stage + Value: !Ref 'Stage' + - Name: ApiMode + Value: identity-gateway + Period: 3600 + Stat: Sum + Unit: Count + ReturnData: false + ComparisonOperator: LessThanThreshold + Threshold: 1 + EvaluationPeriods: 1 + AlarmActions: + - !Ref 'TopicSendEmail' + InsufficientDataActions: + - !Ref 'TopicSendEmail'