{
  "name": "Detect AWS Orphaned Resources & Send Cost Reports to Slack, Email, and Sheets",
  "nodes": [
    {
      "id": "3547928a-cd56-4422-ac30-fc2504f42dee",
      "name": "Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        -16
      ],
      "parameters": {
        "width": 540,
        "height": 556,
        "content": "## 🚨 AWS ORPHANED RESOURCES DETECTOR\n\n**Use this n8n template to identify orphaned resources across all regions of your AWS account. This workflow helps you maintain inventory and control costs by det"
      }
    },
    {
      "id": "3d5fa748-6e6b-4187-8ce1-48af53a7c922",
      "name": "Weekly Scan Trigger1",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -336,
        576
      ]
    },
    {
      "id": "3beec422-ef8f-4be8-8793-162f5c6e71e3",
      "name": "Initialize Config",
      "type": "n8n-nodes-base.set",
      "position": [
        -128,
        576
      ]
    },
    {
      "id": "24b793a7-c33c-4fba-a1be-42edcf171d38",
      "name": "Aggregate All Resources",
      "type": "n8n-nodes-base.aggregate",
      "position": [
        944,
        576
      ]
    },
    {
      "id": "ca8a6e8b-3160-4fe8-ab25-6208f0e78220",
      "name": "Calculate Summary Stats",
      "type": "n8n-nodes-base.code",
      "position": [
        1168,
        576
      ]
    },
    {
      "id": "c22d8fc7-1419-4566-af3f-dac69d52d295",
      "name": "Generate HTML Report",
      "type": "n8n-nodes-base.code",
      "position": [
        1760,
        480
      ]
    },
    {
      "id": "4a98e778-f771-4bbd-a8bd-c540ba354b69",
      "name": "Generate CSV Export",
      "type": "n8n-nodes-base.code",
      "position": [
        1712,
        336
      ]
    },
    {
      "id": "63654b23-50e4-4f19-92ed-c78e0468c182",
      "name": "Send Slack Alert",
      "type": "n8n-nodes-base.slack",
      "position": [
        1712,
        176
      ]
    },
    {
      "id": "20e3faca-3d0c-449d-831f-43cb1931ad96",
      "name": "Send Email Report",
      "type": "n8n-nodes-base.gmail",
      "position": [
        1968,
        480
      ]
    },
    {
      "id": "90ea04a7-1b68-4ae9-8a04-e09667d9d0c0",
      "name": "Set Region Variables",
      "type": "n8n-nodes-base.set",
      "position": [
        80,
        576
      ]
    },
    {
      "id": "f367ac05-a9aa-4484-b3c3-d2c982e2df95",
      "name": "Scan Elastic IPs",
      "type": "n8n-nodes-base.awsLambda",
      "position": [
        352,
        768
      ]
    },
    {
      "id": "486471fa-5ca8-4dd0-91f1-01f4032a216f",
      "name": "Scan EBS Snapshots",
      "type": "n8n-nodes-base.awsLambda",
      "position": [
        352,
        576
      ]
    },
    {
      "id": "7216ce14-d4f9-46f9-b45b-ad67ba633a46",
      "name": "Scan unattached EBS Volumes",
      "type": "n8n-nodes-base.awsLambda",
      "position": [
        352,
        368
      ]
    },
    {
      "id": "1d52b733-68e8-43c1-be04-70600ea0da46",
      "name": "Process Snapshots",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        576
      ]
    },
    {
      "id": "3ad9f8e4-25ea-470a-909a-ea28dcfb7b6a",
      "name": "Process EBS Volumes",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        368
      ]
    },
    {
      "id": "20f26193-ae74-42c8-876e-9d18c8b13e3e",
      "name": "Process Elastic IPs",
      "type": "n8n-nodes-base.code",
      "position": [
        640,
        768
      ]
    },
    {
      "id": "6538af51-e139-4586-9ea0-ba644a405d4d",
      "name": "None Found Slack Message",
      "type": "n8n-nodes-base.slack",
      "position": [
        1712,
        832
      ]
    },
    {
      "id": "aacbb9eb-02ca-4a81-926c-5a53baa3d3c7",
      "name": "Clean Scan CSV Export",
      "type": "n8n-nodes-base.code",
      "position": [
        1712,
        1040
      ]
    },
    {
      "id": "e2dbbe1f-d985-4b59-8a76-4e3950fa5e7e",
      "name": "Append or update row in sheet",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1952,
        1040
      ]
    },
    {
      "id": "b0b31aac-0677-4105-b24c-fd9b2e231c48",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -320,
        -16
      ],
      "parameters": {
        "width": 416,
        "height": 432,
        "content": "## ⚙️ PREREQUISITES CHECKLIST:\n### AWS:\n☐ IAM User: n8n-resource-scanner\n☐ Lambda: aws-orphaned-resource-scanner\n☐ Permissions: EC2 read + Lambda invoke\n\n### n8n:\n☐ AWS IAM credentials\n☐ Slack OAuth/W"
      }
    },
    {
      "id": "f0ad80cd-6aeb-4a6f-ad76-56cfddfb52de",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -912,
        592
      ],
      "parameters": {
        "width": 352,
        "height": 368,
        "content": "## 🔧 CONFIGURATION:\n### Required Tags:\n- Environment\n- Owner  \n- CostCenter\n\n### Settings:\n- Snapshot Age: >90 days\n- Regions: us-east-1 (add more in config)\n- Schedule: Mondays 8 AM UTC\n- Alerts: #cl"
      }
    },
    {
      "id": "a7e7a864-ceba-4e68-bf71-a015872b623b",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2256,
        480
      ],
      "parameters": {
        "width": 352,
        "height": 384,
        "content": "## 🆘 COMMON ISSUES:\n### Lambda 403 Error:\n→ Check IAM policy includes :* wildcard\n\n### No Email Received:\n→ Verify Gmail OAuth permissions\n\n### Google Sheets Empty:\n→ Sheet name must match exactly\n\n##"
      }
    },
    {
      "id": "f5c51923-1760-42fd-ac09-da42b5fbe609",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        288,
        224
      ],
      "parameters": {
        "width": null,
        "height": 768,
        "content": "### 1. Lambda Scans\nScan the AWS region for unattached EBS volumes, snapshots, and Elastic IPs using the Lambda script [here](https://github.com/chadmcrowell/lambda-function-for-aws-orphaned-resource-"
      }
    },
    {
      "id": "d371c1be-2818-4404-ac25-286125b12729",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        576,
        224
      ],
      "parameters": {
        "width": null,
        "height": 768,
        "content": "### 2. Process Scans\nParse the Lambda responses from each resource type and calculate the cost while checking for missing tags."
      }
    },
    {
      "id": "73f05071-d12c-45e3-9524-91abcccd5753",
      "name": "If Resources Found",
      "type": "n8n-nodes-base.if",
      "position": [
        1376,
        576
      ]
    },
    {
      "id": "21157b04-65f1-445c-84a5-8a9db65209c6",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        864,
        448
      ],
      "parameters": {
        "width": 672,
        "height": 304,
        "content": "### 3. Combine and Summarize\nCombine volumes, snapshots, and Elastic IPs into a single array. Sums total montly/annual cost across all resources. Ranks top 5 most expensive resources. Outputs strucutr"
      }
    },
    {
      "id": "77aa964a-91df-4179-93ca-0c316c526bc1",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        -16
      ],
      "parameters": {
        "width": 544,
        "height": 672,
        "content": "### Multi-Channel Alerts (Resources Found)\n\nParallel execution of three outputs:\n- Slack: Immediate alert with top 5 offenders (~1 sec)\n- Email: Professional HTML report with cost breakdown\n- Google S"
      }
    },
    {
      "id": "5cd575f2-2151-414b-8c5d-0e44de0f153a",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1632,
        672
      ],
      "parameters": {
        "width": 544,
        "height": 576,
        "content": "### Multi-Channel Alerts (No Resources Found)\n\nParallel execution of two outputs:\n- Slack: \"All Clear\" confirmation message\n- Google Sheets: Audit trail entry"
      }
    },
    {
      "id": "cefddfd2-b177-4fe6-9d31-b33b15050548",
      "name": "Log to Google Sheets (Found)",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        1952,
        288
      ]
    }
  ],
  "connections": {
    "Scan Elastic IPs": {
      "main": [
        [
          {
            "node": "Process Elastic IPs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Slack Alert": {
      "main": [
        []
      ]
    },
    "Initialize Config": {
      "main": [
        [
          {
            "node": "Set Region Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Snapshots": {
      "main": [
        [
          {
            "node": "Aggregate All Resources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Send Email Report": {
      "main": [
        []
      ]
    },
    "If Resources Found": {
      "main": [
        [
          {
            "node": "Generate HTML Report",
            "type": "main",
            "index": 0
          },
          {
            "node": "Send Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Generate CSV Export",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "None Found Slack Message",
            "type": "main",
            "index": 0
          },
          {
            "node": "Clean Scan CSV Export",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Scan EBS Snapshots": {
      "main": [
        [
          {
            "node": "Process Snapshots",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate CSV Export": {
      "main": [
        [
          {
            "node": "Log to Google Sheets (Found)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process EBS Volumes": {
      "main": [
        [
          {
            "node": "Aggregate All Resources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Process Elastic IPs": {
      "main": [
        [
          {
            "node": "Aggregate All Resources",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate HTML Report": {
      "main": [
        [
          {
            "node": "Send Email Report",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set Region Variables": {
      "main": [
        [
          {
            "node": "Scan unattached EBS Volumes",
            "type": "main",
            "index": 0
          },
          {
            "node": "Scan EBS Snapshots",
            "type": "main",
            "index": 0
          },
          {
            "node": "Scan Elastic IPs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Weekly Scan Trigger1": {
      "main": [
        [
          {
            "node": "Initialize Config",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Clean Scan CSV Export": {
      "main": [
        [
          {
            "node": "Append or update row in sheet",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Aggregate All Resources": {
      "main": [
        [
          {
            "node": "Calculate Summary Stats",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Summary Stats": {
      "main": [
        [
          {
            "node": "If Resources Found",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "None Found Slack Message": {
      "main": [
        []
      ]
    },
    "Scan unattached EBS Volumes": {
      "main": [
        [
          {
            "node": "Process EBS Volumes",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}