Skip to product information

Detect AWS Cost Spikes & Auto-Create Terraform Fix PRs

Detect AWS Cost Spikes & Auto-Create Terraform Fix PRs

 (200+Reviews)
Regular price £51.99
Regular price £51.99 Sale price
SAVE Sold out
⬇
Instant Digital Download
∞
Unlimited Downloads
★
Lifetime Access in Your Account
🔥
128+ Sold
Popular with n8n builders
âš¡
23 people viewing
High interest right now
✅
9 added today
Fast-moving digital product
Detect AWS Cost Spikes & Auto-Create Terraform Fix PRs

Detect AWS Cost Spikes & Auto-Create Terraform Fix PRs

Regular price £51.99
Regular price £51.99 Sale price
SAVE Sold out

Automatically detect AWS Cost Explorer spend spikes and ship Terraform fix PRs

This n8n workflow monitors your AWS daily spend using AWS Cost Explorer, detects cost spikes, correlates them to the latest relevant Terraform change in GitHub, and then uses OpenAI to draft a root-cause analysis and corrected Terraform file—automatically opening a GitHub pull request and posting results to Slack.

What this workflow does

  • Runs on a schedule (every 6 hours) or via manual trigger, with configurable repository, Terraform path, thresholds, and analysis date ranges.
  • Queries AWS Cost Explorer for daily unblended cost by AWS service over the last 8 days, calculates today’s spend vs a rolling baseline average, and compares the percent increase to your configured threshold.
  • If the increase exceeds the threshold, it identifies the top contributing AWS service and continues; otherwise, the run stops.
  • Uses the GitHub API to list recent commits that touched the target Terraform file and selects the most recent commit as the likely source of the change.
  • Fetches the current Terraform file from GitHub and sends cost spike metrics, suspect commit details, and file content to OpenAI to generate a root-cause summary, fix description, and a complete corrected Terraform file.
  • Creates a new GitHub branch, commits the updated Terraform file, opens a pull request, and posts a Slack message containing the cost impact, analysis, and PR link.

Use cases

  • Prevent AWS cost regressions after Terraform changes by detecting spikes early and responding with an automated fix PR.
  • For SaaS operators, reduce time-to-diagnosis when a sudden spend increase points to a specific infrastructure change.
  • For automation engineers, standardize cost incident handling with GitHub PRs and Slack notifications.

Technical details

  • AWS integration: Requires AWS credentials with ce:GetCostAndUsage permissions (Cost Explorer calls made in us-east-1).
  • GitHub integration: Uses GitHub API to inspect commits, create branches, and open pull requests.
  • OpenAI: Generates root-cause analysis and a corrected Terraform file.
  • Slack: Posts results, cost impact, and PR link.
  • n8n nodes / tools mentioned: if, set, code, wait, slack, sticky note.
View full details