-
Notifications
You must be signed in to change notification settings - Fork 3
/
monitoring.tf
38 lines (36 loc) · 1.39 KB
/
monitoring.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
resource "aws_sns_topic" "alerting" {
name = "${var.prefix}-${var.env}-alerting"
display_name = "SNS for DevOps challenge alerting"
}
resource "aws_cloudwatch_metric_alarm" "lambda_errors" {
alarm_name = "${var.prefix}-${var.env}-backend-api-errors"
alarm_description = "Alarm triggered when there some errors on the lambda function"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 5
threshold = 10
period = 60
statistic = "Sum"
treat_missing_data = "notBreaching"
namespace = "AWS/Lambda"
metric_name = "Errors"
alarm_actions = [aws_sns_topic.alerting.arn]
dimensions = {
FunctionName = module.lambda_function.lambda_function_name
}
}
resource "aws_cloudwatch_metric_alarm" "dynamodb_throttled_requests" {
alarm_name = "${var.prefix}-${var.env}-dynamodb-throttled-requests"
alarm_description = "Alarm triggered when requests to DynamoDB exceed the provisioned throughput limits"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 5
threshold = 1
period = 60
statistic = "Sum"
treat_missing_data = "notBreaching"
namespace = "AWS/DynamoDB"
metric_name = "ThrottledRequests"
alarm_actions = [aws_sns_topic.alerting.arn]
dimensions = {
TableName = aws_dynamodb_table.users.name
}
}