aws-accountant
is a dead simple Terraform module which helps you monitor your cloud spend. cloud-accountant
can provision CloudWatch alarms to notify you when:
- Your total AWS bill goes above certain thresholds.
- Egress for your EC2 instances goes above certain thresholds.
Suprise cloud bills are a reality for cloud engineers. AWS provides tools that allow you to configure billing alerts, but they are not enabled by default. cloud-account
makes it dead simple to enable alerts.
See blog post for more context.
Before provision CloudWatch alarms, you must enable billing alerts via the AWS console. As far as I can tell, there is no way to do this programatically (CloudWatch team, looking at you 👀). Instructions for doing so can be found here.
module "aws-accountant" {
source = "[email protected]:kcoleman731/aws-accountant.git"
# Where alerts should go.
email = "[email protected]"
phone_number = "+4445556666"
# Charge threshold config.
charge_thresholds = [
{
name = "Ten"
threshold = "10"
},
{
name = "Twenty"
threshold = "20"
}
]
# Egress threshold config.
egress_threshold = 300
}
Sevice | Metric | Description |
---|---|---|
CloudWatch | EstimatedCharges | Estimated charges for your AWS account at any given point in time. |
CloudWatch | NetworkOut | The number of bytes sent out by the instance on all network interfaces. I.E. egress data. |
Want more? Shoot me feedback.
For billing alerts, aws-accountant
provisions CloudWatch alarms which monitor the EstimatedCharges
metric for your account. You are able to specify multiple thresholds and get alerts each time one is reached.
For egress alerts, aws-accountant
provisions a CloudWatch alarm which monitors the NetworkOut
metric for your EC2 instances. You can specific specific instance ids, or have aws-accountant
query your account for all instances and configure alerts for each.
For Egress Alerts -
aws-accountant
will query for AWS instances that are tagged withMonitorEgress = true
. If no instances are found, Terraform apply will fail.
In order to recieve alerts, cloud-accountant
will provision an SNS topic for both types of alarm. It will then subscribe your phone number (to recieve SMS) and you email address (to recieve emails) to the SNS topic.
Apache 2 Licensed. See LICENSE for full details.