Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3379610
D11139.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D11139.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D11139: [terraform] Add cloudwatch alert for search index lambda failures
Attached
Detach File
Event Timeline
Log In to Comment