Skip to content

Commit 0335ef4

Browse files
add athena and glue budget alert (#2328)
* add athena budget alert * configure budget and anomaly subscriptions * change commit ref * add tags * add Glue budget * change Athena limits * remove unsupported tags argument from budgets * set value argument * pin to release 1.4.0 * change name of parameter * add value attribute --------- Co-authored-by: Tim Burke <[email protected]>
1 parent de48c62 commit 0335ef4

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

terraform/core/34-aws-budget-alerting.tf

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,81 @@ module "set_budget_limit_amount" {
99
account_id = data.aws_caller_identity.data_platform.account_id
1010
emails_to_notify = var.emails_to_notify_with_budget_alerts
1111
}
12+
13+
resource "aws_ssm_parameter" "budget_alert_recipients" {
14+
name = "/data-and-insight/budget-alert-recipients"
15+
type = "StringList"
16+
value = "value"
17+
tags = module.tags.values
18+
}
19+
20+
data "aws_ssm_parameter" "budget_alert_recipients" {
21+
name = aws_ssm_parameter.budget_alert_recipients.value
22+
}
23+
24+
module "aws_budget_athena" {
25+
count = local.is_live_environment ? 1 : 0
26+
source = "github.com/LBHackney-IT/ce-aws-budgets-lbh.git?ref=176a7e7234d74d94d5116c7f0b5d59f6e6db0a48" # v1.4.0
27+
28+
budget_name = "Athena Daily Budget Alert"
29+
budget_type = "COST"
30+
limit_amount = local.is_production_environment ? "5" : "3"
31+
time_unit = "DAILY"
32+
33+
cost_filter = [
34+
{
35+
name = "Service"
36+
values = ["Amazon Athena"]
37+
}
38+
]
39+
40+
comparison_operator = "GREATER_THAN"
41+
threshold = 100
42+
threshold_type = "PERCENTAGE"
43+
notification_type = "ACTUAL"
44+
subscriber_email_addresses = [data.aws_ssm_parameter.budget_alert_recipients.value]
45+
46+
enable_anomaly_detection = true
47+
anomaly_monitor_name = "AthenaDailyAnomalyMonitor"
48+
anomaly_monitor_type = "DIMENSIONAL"
49+
anomaly_monitor_dimension = "SERVICE"
50+
anomaly_subscription_name = "AthenaDailySubscription"
51+
anomaly_subscription_frequency = "DAILY"
52+
threshold_key = "ANOMALY_TOTAL_IMPACT_ABSOLUTE"
53+
match_options = ["GREATER_THAN_OR_EQUAL"]
54+
threshold_values = ["1"]
55+
}
56+
57+
module "aws_budget_glue" {
58+
count = local.is_live_environment ? 1 : 0
59+
source = "github.com/LBHackney-IT/ce-aws-budgets-lbh.git?ref=671dab00698fbef054ebc15b7928e03aae525583"
60+
61+
62+
budget_name = "Glue Daily Budget Alert"
63+
budget_type = "COST"
64+
limit_amount = local.is_production_environment ? "45" : "15"
65+
time_unit = "DAILY"
66+
67+
cost_filter = [
68+
{
69+
name = "Service"
70+
values = ["Amazon Glue"]
71+
}
72+
]
73+
74+
comparison_operator = "GREATER_THAN"
75+
threshold = 100
76+
threshold_type = "PERCENTAGE"
77+
notification_type = "ACTUAL"
78+
subscriber_email_addresses = [data.aws_ssm_parameter.budget_alert_recipients.value]
79+
80+
enable_anomaly_detection = true
81+
anomaly_monitor_name = "AthenaDailyAnomalyMonitor"
82+
anomaly_monitor_type = "DIMENSIONAL"
83+
anomaly_monitor_dimension = "SERVICE"
84+
anomaly_subscription_name = "AthenaDailySubscription"
85+
anomaly_subscription_frequency = "DAILY"
86+
threshold_key = "ANOMALY_TOTAL_IMPACT_ABSOLUTE"
87+
match_options = ["GREATER_THAN_OR_EQUAL"]
88+
threshold_values = ["1"]
89+
}

0 commit comments

Comments
 (0)