-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloudwatch.tf
38 lines (36 loc) · 1.26 KB
/
cloudwatch.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
resource "aws_cloudwatch_metric_alarm" "cpu_high_alarm" {
alarm_name = "bibleapi-alarm-cpu-high"
alarm_description = "This alarm triggers when CPU load in Autoscaling group is high."
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
dimensions {
AutoScalingGroupName = "${aws_autoscaling_group.autoscaling_group.name}"
}
statistic = "Average"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
period = 60
threshold = 40
# http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
alarm_actions = [
"${aws_autoscaling_policy.autoscale_group_policy_up_x1.arn}",
]
}
resource "aws_cloudwatch_metric_alarm" "cpu_low_alarm" {
alarm_name = "bibleapi-alarm-cpu-low"
alarm_description = "This alarm triggers when CPU load in Autoscaling group is low."
metric_name = "CPUUtilization"
namespace = "AWS/EC2"
dimensions {
AutoScalingGroupName = "${aws_autoscaling_group.autoscaling_group.name}"
}
statistic = "Average"
comparison_operator = "LessThanOrEqualToThreshold"
evaluation_periods = "1"
period = 60
threshold = 35
# http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html
alarm_actions = [
"${aws_autoscaling_policy.autoscale_group_policy_down_x1.arn}",
]
}