Skip to content

Latest commit

 

History

History
78 lines (53 loc) · 3.22 KB

README.md

File metadata and controls

78 lines (53 loc) · 3.22 KB

👨‍💼🧮 AWS Accountant

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:

  1. Your total AWS bill goes above certain thresholds.
  2. Egress for your EC2 instances goes above certain thresholds.

💪 Motivation


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.

✅ Prerequisites


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.

🎉 Usage


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
}

📈 Metric Coverage


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.

💼 How it works


Billing Alerts

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.

Egress Alerts

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 with MonitorEgress = true. If no instances are found, Terraform apply will fail.

Notifications

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.

📋 License s


Apache 2 Licensed. See LICENSE for full details.