File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # CloudWatch Alarms for RDS
2+ # Monitors critical database metrics
3+
4+ resource "aws_cloudwatch_metric_alarm" "rds_cpu" {
5+ alarm_name = " rds-cpu-utilization-high"
6+ comparison_operator = " GreaterThanThreshold"
7+ evaluation_periods = 3
8+ metric_name = " CPUUtilization"
9+ namespace = " AWS/RDS"
10+ period = 300
11+ statistic = " Average"
12+ threshold = 80
13+ alarm_description = " RDS CPU utilization above 80%"
14+ }
15+
16+ resource "aws_cloudwatch_metric_alarm" "rds_connections" {
17+ alarm_name = " rds-connections-high"
18+ comparison_operator = " GreaterThanThreshold"
19+ evaluation_periods = 2
20+ metric_name = " DatabaseConnections"
21+ namespace = " AWS/RDS"
22+ period = 300
23+ statistic = " Average"
24+ threshold = 100
25+ alarm_description = " RDS connections exceeding threshold"
26+ }
27+
28+ resource "aws_cloudwatch_metric_alarm" "rds_storage" {
29+ alarm_name = " rds-free-storage-low"
30+ comparison_operator = " LessThanThreshold"
31+ evaluation_periods = 2
32+ metric_name = " FreeStorageSpace"
33+ namespace = " AWS/RDS"
34+ period = 300
35+ statistic = " Average"
36+ threshold = 5368709120 # 5GB in bytes
37+ alarm_description = " RDS free storage below 5GB"
38+ }
You can’t perform that action at this time.
0 commit comments