File tree Expand file tree Collapse file tree 2 files changed +46
-1
lines changed
Expand file tree Collapse file tree 2 files changed +46
-1
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,19 @@ resource "aws_iam_policy" "transfer_kill_switch" {
8282 " transfer:StopServer" ,
8383 ]
8484 Resource = " *"
85+ },
86+ {
87+ Effect = " Allow"
88+ Action = [
89+ " cloudwatch:PutMetricData" ,
90+ ]
91+ Resource = " *"
92+ Condition = {
93+ StringEquals = {
94+ " cloudwatch:namespace" = " Custom/TransferKillSwitch"
95+ }
96+ }
8597 }
8698 ]
8799 })
88- }
100+ }
Original file line number Diff line number Diff line change 1+ resource "aws_cloudwatch_metric_alarm" "transfer_kill_switch_stopped_server" {
2+ count = 1
3+
4+ alarm_name = " ${ terraform . workspace } _transfer_family_kill_switch_stopped"
5+ namespace = " Custom/TransferKillSwitch"
6+ metric_name = " ServerStopped"
7+ statistic = " Sum"
8+ period = 600 # check every 10 mins
9+ evaluation_periods = 1
10+ comparison_operator = " GreaterThanThreshold"
11+ threshold = 0
12+ treat_missing_data = " notBreaching"
13+
14+ dimensions = {
15+ Workspace = terraform.workspace
16+ # Optionally, also filter to a specific server if you want:
17+ # ServerId = "s-xxxxxxxxxxxx"
18+ }
19+
20+ alarm_description = " Alarm when the Transfer Family kill switch stops a server in workspace ${ terraform . workspace } ."
21+
22+ # Reuse the same topic that sends SQS alarms to IMAlertingLambda
23+ alarm_actions = [module . sqs_alarm_lambda_topic . arn ]
24+ ok_actions = [module . sqs_alarm_lambda_topic . arn ]
25+
26+ tags = {
27+ Name = " ${ terraform . workspace } _transfer_family_kill_switch_stopped"
28+ severity = " high"
29+ alarm_group = " transfer_kill_switch"
30+ alarm_metric = " ServerStopped"
31+ is_kpi = " false"
32+ }
33+ }
You can’t perform that action at this time.
0 commit comments