-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAWS_CloudWatch.tf
32 lines (27 loc) · 912 Bytes
/
AWS_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
resource "aws_cloudwatch_log_group" "madhatter-log_group" {
name = "/aws/data-lake/logs"
retention_in_days = 14
}
resource "aws_cloudwatch_log_stream" "madhatter-log_stream" {
name = "data-lake-log-stream"
log_group_name = aws_cloudwatch_log_group.madhatter-log_group.name
}
resource "aws_cloudwatch_metric_alarm" "madhatter-cpu_alarm" {
alarm_name = "high_cpu_utilization"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "2"
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "300"
statistic = "Average"
threshold = "80"
dimensions = {
DBInstanceIdentifier = aws_db_instance.db.id
}
alarm_actions = [
"arn:aws:sns:us-west-2:123456789012:madhatter_sns_topic"
]
}
resource "aws_sns_topic" "madhatter_sns_topic" {
name = "madhatter_sns_topic"
}