Created
March 29, 2019 13:29
-
-
Save kylegordon/3dc90b693ccc1af5aa1973a34fb7169f to your computer and use it in GitHub Desktop.
AWS Billing Alert
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# aws cloudformation deploy --region us-east-1 --stack-name billing-alerts --template-file billingalert.yaml | |
Description: "Billing alerts" | |
AWSTemplateFormatVersion: "2010-09-09" | |
Parameters: | |
DevAlarmThreshold: | |
Description: Development account alarm threshold. | |
Type: Number | |
Default: 20 | |
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: YourNumericalAccountID | |
Statistic: Maximum | |
Period: '21600' | |
EvaluationPeriods: '1' | |
Threshold: | |
Ref: "DevAlarmThreshold" | |
ComparisonOperator: GreaterThanThreshold | |
AlarmActions: | |
- Ref: BillingAlertContact | |
InsufficientDataActions: | |
- Ref: BillingAlertContact | |
BillingAlertContact: | |
Type: AWS::SNS::Topic | |
Properties: | |
# Don't specify a TopicName as that will prevent resource updates that | |
# require replacement. https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-sns-topic.html#cfn-sns-topic-name | |
DisplayName: "BillingAlertNotification" | |
Subscription: | |
- Endpoint: "you@youremail.com" | |
Protocol: email |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment