Skip to content

Commit 82afaaf

Browse files
committed
Adding alarm for low credit balance on EFS
1 parent 20573b9 commit 82afaaf

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

_variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ variable "alarm_alb_400_errors_threshold" {
125125
default = 10
126126
}
127127

128+
variable "alarm_efs_credits_low_threshold" {
129+
description = "Alerts when EFS credits fell below this number in bytes - default 1000000000000 is 1TB of a maximum of 2.31T of credits (use 0 to disable this alarm)"
130+
default = 1000000000000
131+
}
132+
128133
variable "expire_backup_efs" {
129134
default = 0
130135
description = "Number of days the backup will be expired"

cloutwatch-alarms-efs.tf

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
resource "aws_cloudwatch_metric_alarm" "efs_credits_low" {
2+
count = length(var.alarm_sns_topics) > 0 && var.alarm_efs_credits_low_threshold != 0 ? 1 : 0
3+
4+
alarm_name = "${data.aws_iam_account_alias.current.account_alias}-ecs-${var.name}-efs-credits-low"
5+
comparison_operator = "LessThanOrEqualToThreshold"
6+
evaluation_periods = "3"
7+
metric_name = "BurstCreditBalance"
8+
namespace = "AWS/EFS"
9+
period = "120"
10+
statistic = "Average"
11+
threshold = var.alarm_efs_credits_low_threshold
12+
alarm_description = "EFS credits below threshold"
13+
alarm_actions = var.alarm_sns_topics
14+
ok_actions = var.alarm_sns_topics
15+
insufficient_data_actions = []
16+
treat_missing_data = "ignore"
17+
18+
dimensions = {
19+
FileSystemId = aws_efs_file_system.ecs.id
20+
}
21+
}

0 commit comments

Comments
 (0)