Page MenuHomePhabricator

D11139.diff
No OneTemporary

D11139.diff

diff --git a/services/terraform/remote/aws_cloudwatch_alarms.tf b/services/terraform/remote/aws_cloudwatch_alarms.tf
new file mode 100644
--- /dev/null
+++ b/services/terraform/remote/aws_cloudwatch_alarms.tf
@@ -0,0 +1,31 @@
+locals {
+ lambda_error_subscribed_email = "error-reports@comm.app"
+ lambda_error_threshold = "2"
+}
+
+resource "aws_sns_topic" "lambda_alarm_topic" {
+ name = "lambda-error-alarm-topic"
+}
+
+resource "aws_sns_topic_subscription" "email_subscription" {
+ topic_arn = aws_sns_topic.lambda_alarm_topic.arn
+ protocol = "email"
+ endpoint = local.lambda_error_subscribed_email
+}
+
+resource "aws_cloudwatch_metric_alarm" "lambda_error_alarm" {
+ alarm_name = "search-index-lambda-error-alarm"
+ comparison_operator = "GreaterThanOrEqualToThreshold"
+ evaluation_periods = "1"
+ metric_name = "LambdaErrors"
+ namespace = "AWS/Lambda"
+ period = "300"
+ statistic = "Sum"
+ threshold = local.lambda_error_threshold
+ alarm_description = "Alarm tracking search index lambda function failure"
+ actions_enabled = true
+ alarm_actions = [aws_sns_topic.lambda_alarm_topic.arn]
+ dimensions = {
+ FunctionName = module.shared.search_index_lambda.function_name
+ }
+}

File Metadata

Mime Type
text/plain
Expires
Thu, Nov 28, 5:33 PM (20 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2594529
Default Alt Text
D11139.diff (1 KB)

Event Timeline