GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - omers/aws-cost-anomaly-detector: AWS Cost Anomaly Detection Terraform module

BranchesTags
Open more actions menu

Latest commit

 

History

31 Commits
31 Commits

Folders and files

NameName
Last commit message
Last commit date
.github
.github
 
 
.gitignore
.gitignore
 
 
CLAUDE.md
CLAUDE.md
 
 
README.md
README.md
 
 
main.tf
main.tf
 
 
outputs.tf
outputs.tf
 
 
provider.tf
provider.tf
 
 
terraform.tfvars.example
terraform.tfvars.example
 
 
variables.tf
variables.tf
 
 

Repository files navigation

AWS Cost Anomaly Detector 🚨

Description

This Terraform module streamlines AWS cost management by automatically setting up AWS Cost Anomaly Detection. It continuously monitors your cloud expenses and instantly alerts you to unexpected cost spikes—helping you optimize your AWS billing, prevent overspending, and maintain tight control over your cloud budget. Whether you're looking to enhance cost monitoring, streamline AWS cost management, or integrate automated cost alerts into your infrastructure, this module is your key to a more predictable and efficient AWS spending strategy.

Key Features

  • Simple Deployment: Intuitive and declarative Terraform module for cost anomaly detection.
  • Automated Configuration: Automatically configures AWS Cost Explorer and anomaly detection settings.
  • Real-time Alerts: Receive instant notifications for cost anomalies.
  • Cost Optimization: Gain insights to optimize AWS spending and identify cost-saving opportunities.
  • Scalability: Supports large-scale AWS environments with ease.

Quick Start

terraform {
# Setup yor state backend here. 
# Either s3 / local
}


module "cost_anomaly_detection" {
  source  = "github.com/omers/aws-cost-anomaly-detector.git"
  
  region                = "us-west-2"
  environment           = "production"
  emails                = ["[email protected]", "[email protected]"]
  raise_amount_percent  = "20"
  raise_amount_absolute = "100"
  
  # Optional PagerDuty integration
  create_pagerduty      = true
  pagerduty_endpoint    = "https://events.pagerduty.com/integration/abcdef123456/enqueue"
  
  resource_tags = {
    ManagedBy = "Terraform"
    Project   = "CostOptimization"
  }
}

Prerequisites

  • Terraform v1.0+
  • AWS account with appropriate permissions
  • AWS provider v5.6.2 or later

PagerDuty Setup

  1. Create a new PagerDuty service with the Amazon CloudWatch integration type.
  2. Copy the PagerDuty Integration URL to the pagerduty_endpoint input variable.
  3. Set create_pagerduty = true in your module configuration.

Module Documentation

Requirements

Name Version
aws ~> 5.0

Providers

Name Version
aws ~> 5.0

Modules

No modules.

Resources

Name Type
aws_ce_anomaly_monitor.anomaly_monitor resource
aws_ce_anomaly_subscription.realtime_subscription resource
aws_sns_topic.cost_anomaly_updates resource
aws_sns_topic_policy.default resource
aws_sns_topic_subscription.pagerduty resource
aws_sns_topic_subscription.topic_email_subscription resource
aws_caller_identity.current data source
aws_iam_policy_document.sns_topic_policy data source

Inputs

Name Description Type Default Required
create_pagerduty Set to true in order to send notifications to PagerDuty bool false no
emails List of email addresses to notify list(any) n/a yes
environment The account environment (Prod / Dev etc.) string n/a yes
pagerduty_endpoint The PagerDuty HTTPS endpoint where SNS notifications will be sent to string n/a yes
raise_amount_absolute The Absolut increase in USD to trigger the detector. (ANOMALY_TOTAL_IMPACT_ABSOLUTE) string n/a yes
raise_amount_percent An Expression object used to specify the anomalies that you want to generate alerts for. The precentage service cost increase than the expected string n/a yes
region AWS Region string n/a yes
resource_tags Tags to set for all resources map(string) {} no

Outputs

Name Description
sns_arn n/a

About

AWS Cost Anomaly Detection Terraform module

Topics

awsaws-cost-explorercost-controlfinopsmonitoringterraform

Resources

Readme
Activity

Stars

2 stars

Watchers

1 watching

Forks

3 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.