Detect AWS cost spikes and open Terraform fix PRs with OpenAI and Slack
Needs changesWhat this workflow does
This AI workflow has 18 nodes and runs on a schedule (cron 0 */6 * * *) (plus 1 other trigger). Along the way it connects OpenAI Chat Model and Slack. It also calls ce.us-east-1.amazonaws.com over HTTP.
How it runs
Trigger: On a schedule (cron 0 */6 * * *) (plus 1 other trigger).
- Set - Config (Edit Fields (Set)): sets 9 fields: repoOwner, repoName, terraformPath…
- HTTP Request: calls ce.us-east-1.amazonaws.com (POST)
- JS - Parse Cost Data & Detect Spike (Code): runs custom JavaScript code
- If: checks a condition and branches into true / false
- HTTP Request: calls an HTTP API
- JS - Identify Root-Cause Commit (Code): runs custom JavaScript code
- HTTP Request: calls an HTTP API
- AI - Generate Root Cause Analysis & Terraform Fix (AI Agent): runs an AI agent, with model: OpenAI Chat Model
- JS - Parse AI Fix Output & Build Payloads (Code): runs custom JavaScript code
- HTTP Request: calls an HTTP API
…plus 5 more steps. See the full node list below.
Services it uses
HTTP calls to: ce.us-east-1.amazonaws.com
Before you upgrade to n8n 3.0
1 thing in this workflow is removed in n8n 3.0. Fix it before you upgrade:
- AI Agent v1 (old agent modes) in AI - Generate Root Cause Analysis & Terraform Fix (v1.6): replace with Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent.
Rather not rewrite it? Many of these flows can be rebuilt in Make (free plan).
| Removed in 3.0 | Replace with |
|---|---|
| AI Agent v1 (old agent modes) AI - Generate Root Cause Analysis & Terraform Fix (v1.6) | Latest AI Agent node (Tools Agent). For SQL Agent, use a Postgres or MySQL tool with a recent AI Agent. |
Nodes used (10)
- Schedule Trigger
n8n-nodes-base.scheduleTrigger - Manual Trigger
n8n-nodes-base.manualTrigger - Edit Fields (Set)
n8n-nodes-base.set - HTTP Request
n8n-nodes-base.httpRequest - Code
n8n-nodes-base.code - If
n8n-nodes-base.if - AI Agent
@n8n/n8n-nodes-langchain.agent - OpenAI Chat Model
@n8n/n8n-nodes-langchain.lmChatOpenAi - Slack
n8n-nodes-base.slack - Wait
n8n-nodes-base.wait
From the author
Quick overview This workflow runs every 6 hours to detect AWS Cost Explorer spend spikes, correlates the spike to the latest Terraform change in GitHub, uses OpenAI to draft a root-cause analysis and updated Terraform file, opens a GitHub pull request with…