[tor-commits] [metrics-cloud/master] billing: Alert if spending too much

irl at torproject.org irl at torproject.org
Thu Oct 3 14:45:37 UTC 2019


commit ba1148b6b98acdebf3c861f22a19b59cde829922
Author: Iain R. Learmonth <irl at fsfe.org>
Date:   Thu Oct 3 15:42:50 2019 +0100

    billing: Alert if spending too much
---
 cloudformation/billing-alerts.yml | 40 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/cloudformation/billing-alerts.yml b/cloudformation/billing-alerts.yml
new file mode 100644
index 0000000..50d6b3e
--- /dev/null
+++ b/cloudformation/billing-alerts.yml
@@ -0,0 +1,40 @@
+# CloudFormation Stack for Billing Alerts
+# This stack will only deploy on us-east-1 (that's where billing happens)
+# aws cloudformation deploy --region us-east-1 --stack-name billing-alerts --template-file billing-alerts.yml
+Description: "Billing alerts"
+AWSTemplateFormatVersion: "2010-09-09"
+Parameters:
+  DevAlarmThreshold:
+    Description: Development account alarm threshold.
+    Type: Number
+    Default: 50
+Resources:
+  DevSpendingAlarm:
+    Type: AWS::CloudWatch::Alarm
+    Properties:
+      AlarmDescription: !Sub >
+        "Alarm if AWS development account spending is over $${DevAlarmThreshold}"
+      Namespace: AWS/Billing
+      MetricName: EstimatedCharges
+      Dimensions:
+      - Name: Currency
+        Value: USD
+      - Name: LinkedAccount
+        Value: !Sub ${AWS::AccountId}
+      Statistic: Maximum
+      Period: '21600'
+      EvaluationPeriods: '1'
+      Threshold:
+        Ref: "DevAlarmThreshold"
+      ComparisonOperator: GreaterThanThreshold
+      AlarmActions:
+      - Ref: BillingAlertContact
+      InsufficientDataActions:
+      - Ref: BillingAlertContact
+  BillingAlertContact:
+    Type: AWS::SNS::Topic
+    Properties:
+      DisplayName: "BillingAlertNotification"
+      Subscription:
+        - Endpoint: "irl at torproject.org"
+          Protocol: email





More information about the tor-commits mailing list