-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonitoring.tf
More file actions
38 lines (35 loc) · 1.26 KB
/
monitoring.tf
File metadata and controls
38 lines (35 loc) · 1.26 KB
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
# CloudWatch Alarms for RDS
# Monitors critical database metrics
resource "aws_cloudwatch_metric_alarm" "rds_cpu" {
alarm_name = "rds-cpu-utilization-high"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 3
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = 300
statistic = "Average"
threshold = 80
alarm_description = "RDS CPU utilization above 80%"
}
resource "aws_cloudwatch_metric_alarm" "rds_connections" {
alarm_name = "rds-connections-high"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = 2
metric_name = "DatabaseConnections"
namespace = "AWS/RDS"
period = 300
statistic = "Average"
threshold = 100
alarm_description = "RDS connections exceeding threshold"
}
resource "aws_cloudwatch_metric_alarm" "rds_storage" {
alarm_name = "rds-free-storage-low"
comparison_operator = "LessThanThreshold"
evaluation_periods = 2
metric_name = "FreeStorageSpace"
namespace = "AWS/RDS"
period = 300
statistic = "Average"
threshold = 5368709120 # 5GB in bytes
alarm_description = "RDS free storage below 5GB"
}