AWS Azure GCPマルチクラウドコスト監視と予算制御アラート
これはDevOps, Multimodal AI分野の自動化ワークフローで、12個のノードを含みます。主にIf, Code, Cron, Slack, WhatsAppなどのノードを使用。 AWS Azure GCPのマルチクラウドコスト監視と予算制御アラート
- •Slack Bot Token または Webhook URL
- •ターゲットAPIの認証情報が必要な場合あり
{
"id": "EeqqXkRfJ6ADiRgm",
"meta": {
"instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
"templateCredsSetupCompleted": true
},
"name": "AWS Azure GCP Multi-Cloud Cost Monitoring & Alerts for Budget Control",
"tags": [],
"nodes": [
{
"id": "b172287e-8522-4204-af8c-a85554e1b9f8",
"name": "Cron Trigger",
"type": "n8n-nodes-base.cron",
"position": [
140,
-180
],
"parameters": {},
"typeVersion": 1
},
{
"id": "9a9bbc21-a699-499e-8c49-1e93ae8304ff",
"name": "AWS Billing Fetch",
"type": "n8n-nodes-base.httpRequest",
"position": [
360,
-380
],
"parameters": {
"url": "https://ce.us-east-1.amazonaws.com/",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": []
},
"genericAuthType": "httpBasicAuth",
"headerParameters": {
"parameters": [
{
"name": "X-Amz-Target",
"value": "AWSInsightsIndexService.GetCostAndUsage"
},
{
"name": "Content-Type",
"value": "application/x-amz-json-1.1"
}
]
}
},
"credentials": {
"httpBasicAuth": {
"id": "in1EZeEnhkmqnkds",
"name": "test - auth"
}
},
"typeVersion": 4.2
},
{
"id": "df146231-83a9-4a21-abcd-d614aeed73d2",
"name": "Azure Billing Fetch",
"type": "n8n-nodes-base.httpRequest",
"position": [
360,
-180
],
"parameters": {
"url": "https://management.azure.com/subscriptions/{{ $vars.AZURE_SUBSCRIPTION_ID }}/providers/Microsoft.CostManagement/query?api-version=2021-10-01",
"method": "POST",
"options": {},
"sendBody": true,
"sendHeaders": true,
"authentication": "genericCredentialType",
"bodyParameters": {
"parameters": [
{}
]
},
"genericAuthType": "oAuth1Api",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"oAuth1Api": {
"id": "wGEB2bR15nIzYwVz",
"name": "test-auth"
}
},
"typeVersion": 4.2
},
{
"id": "cc6d124d-c8fe-4da7-ab36-46d5f4d896bf",
"name": "GCP Billing Fetch",
"type": "n8n-nodes-base.httpRequest",
"position": [
360,
20
],
"parameters": {
"url": "https://cloudbilling.googleapis.com/v1/billingAccounts/{{ $vars.GCP_BILLING_ACCOUNT_ID }}/services",
"options": {},
"sendQuery": true,
"authentication": "genericCredentialType",
"genericAuthType": "oAuth1Api",
"queryParameters": {
"parameters": [
{
"name": "filter",
"value": "usage_start_time >= \"{{ $now.minus({hours: 1}).toISO() }}\" AND usage_start_time < \"{{ $now.toISO() }}\""
}
]
}
},
"credentials": {
"oAuth1Api": {
"id": "wGEB2bR15nIzYwVz",
"name": "test-auth"
}
},
"typeVersion": 4.2
},
{
"id": "51f29b8b-cbc0-41e4-8116-1768cc411073",
"name": "データパーサー",
"type": "n8n-nodes-base.code",
"position": [
580,
-180
],
"parameters": {
"jsCode": "const items = $input.all();\nconst mergedData = [];\n\nfor (const item of items) {\n const platform = item.json.platform || 'unknown';\n const cost = item.json.cost || item.json.totalCost || 0;\n const resourceId = item.json.resourceId || item.json.service || 'unknown';\n \n mergedData.push({\n platform,\n cost: parseFloat(cost),\n resourceId,\n timestamp: new Date().toISOString(),\n owner: item.json.tags?.owner || item.json.owner || 'untagged'\n });\n}\n\nreturn mergedData.map(data => ({ json: data }));"
},
"typeVersion": 2
},
{
"id": "6eb4ef65-cdc4-43eb-86f4-00a063b50e90",
"name": "急上昇コスト検出",
"type": "n8n-nodes-base.code",
"position": [
800,
-180
],
"parameters": {
"jsCode": "const items = $input.all();\nconst alerts = [];\nconst COST_THRESHOLD = parseFloat($vars.COST_THRESHOLD || '50');\nconst SPIKE_MULTIPLIER = parseFloat($vars.SPIKE_MULTIPLIER || '2.0');\n\nfor (const item of items) {\n const cost = item.json.cost;\n const platform = item.json.platform;\n const resourceId = item.json.resourceId;\n \n // Simple spike detection - compare with threshold\n if (cost > COST_THRESHOLD) {\n alerts.push({\n type: 'threshold_exceeded',\n platform,\n resourceId,\n currentCost: cost,\n threshold: COST_THRESHOLD,\n owner: item.json.owner,\n severity: cost > (COST_THRESHOLD * 2) ? 'HIGH' : 'MEDIUM'\n });\n }\n}\n\nreturn alerts.map(alert => ({ json: alert }));"
},
"typeVersion": 2
},
{
"id": "ee98766c-e7e2-4f2c-8d25-9b25a8d9ef24",
"name": "オーナー識別",
"type": "n8n-nodes-base.if",
"position": [
1020,
-180
],
"parameters": {
"options": {},
"conditions": {
"options": {
"version": 1,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "owner-check",
"operator": {
"type": "string",
"operation": "equals",
"rightType": "manual"
},
"leftValue": "={{ $json.owner }}",
"rightValue": "untagged"
}
]
}
},
"typeVersion": 2
},
{
"id": "8eb36fe2-846e-47db-9771-38648146a629",
"name": "リソース自動タグ付け",
"type": "n8n-nodes-base.code",
"position": [
1240,
-180
],
"parameters": {
"jsCode": "// Auto-tagging logic based on platform\nconst item = $input.first().json;\nconst platform = item.platform;\nconst resourceId = item.resourceId;\n\nlet tagCommand = '';\n\nswitch(platform) {\n case 'aws':\n tagCommand = `aws ec2 create-tags --resources ${resourceId} --tags Key=CostAlert,Value=true Key=AlertTime,Value=${new Date().toISOString()}`;\n break;\n case 'azure':\n tagCommand = `az resource tag --ids ${resourceId} --tags CostAlert=true AlertTime=${new Date().toISOString()}`;\n break;\n case 'gcp':\n tagCommand = `gcloud compute instances add-labels ${resourceId} --labels=cost-alert=true,alert-time=${Date.now()}`;\n break;\n}\n\nreturn [{ json: { ...item, tagCommand } }];"
},
"typeVersion": 2
},
{
"id": "d07764c6-fc5b-4614-ad39-b9373b67daaa",
"name": "メールによるアラート送信",
"type": "n8n-nodes-base.emailSend",
"position": [
1460,
-380
],
"webhookId": "21220fdd-726e-49ea-bb17-acb0f492c96e",
"parameters": {
"text": "=🚨 **Cost Alert** 🚨|**Platform:** {{ $json.platform }}**Resource:** {{ $json.resourceId }}**Current Cost:** ${{ $json.currentCost }}**Threshold:** ${{ $json.threshold }}**Owner:** {{ $json.owner }}**Severity:** {{ $json.severity }}**Time:** {{ $json.timestamp }}*Auto-tagging command:*```{{ $json.tagCommand }}```",
"options": {},
"subject": "🚨 **Cost Alert** 🚨",
"toEmail": "abcdef@gmail.com,xyzabc@gmail.com",
"fromEmail": "abc@gmail.com",
"emailFormat": "text"
},
"credentials": {
"smtp": {
"id": "G1kyF8cSWTZ4vouN",
"name": "SMTP -test"
}
},
"typeVersion": 2.1
},
{
"id": "becc8559-a46a-4d31-a2f9-9b92d2de2d55",
"name": "WhatsApp によるアラート送信",
"type": "n8n-nodes-base.whatsApp",
"position": [
1460,
-180
],
"webhookId": "6054006c-c647-4ca7-8c64-185201aeebe7",
"parameters": {
"textBody": "=🚨 **Cost Alert** 🚨|**Platform:** {{ $json.platform }}**Resource:** {{ $json.resourceId }}**Current Cost:** ${{ $json.currentCost }}**Threshold:** ${{ $json.threshold }}**Owner:** {{ $json.owner }}**Severity:** {{ $json.severity }}**Time:** {{ $json.timestamp }}*Auto-tagging command:*```{{ $json.tagCommand }}```",
"operation": "send",
"phoneNumberId": "=+919999888877",
"additionalFields": {},
"recipientPhoneNumber": "+919999888844,+919999888833,+919999888822"
},
"credentials": {
"whatsAppApi": {
"id": "b0PxTDPdWzznWnfG",
"name": "WhatsApp-test "
}
},
"typeVersion": 1
},
{
"id": "7cfa7945-ad77-46aa-9942-30a27bc77d55",
"name": "Slack によるアラート送信",
"type": "n8n-nodes-base.slack",
"position": [
1460,
20
],
"webhookId": "13a6db34-bc6a-4744-9c02-ed3d9260ceb2",
"parameters": {
"text": "🚨 **Cost Alert** 🚨\n\n**Platform:** {{ $json.platform }}\n**Resource:** {{ $json.resourceId }}\n**Current Cost:** ${{ $json.currentCost }}\n**Threshold:** ${{ $json.threshold }}\n**Owner:** {{ $json.owner }}\n**Severity:** {{ $json.severity }}\n**Time:** {{ $json.timestamp }}\n\n*Auto-tagging command:*\n```{{ $json.tagCommand }}```",
"select": "channel",
"channelId": {
"__rl": true,
"mode": "name",
"value": "{{ $vars.SLACK_CHANNEL_ID }}"
},
"otherOptions": {}
},
"credentials": {
"slackApi": {
"id": "MQ0fgwuS8AzfwFvy",
"name": "Slack account - test "
}
},
"typeVersion": 2
},
{
"id": "e3274f83-533e-4cc9-af50-cb50e7ba5db4",
"name": "付箋",
"type": "n8n-nodes-base.stickyNote",
"position": [
620,
-620
],
"parameters": {
"color": 6,
"width": 700,
"height": 300,
"content": "## **How It Works**\n\n1. **Hourly Cron Trigger** – Starts the workflow every hour to fetch updated billing data.\n2. **AWS Billing Fetch** – Retrieves latest cost and usage data via AWS Cost Explorer API.\n3. **Azure Billing Fetch** – Retrieves subscription cost data from Azure Cost Management API.\n4. **GCP Billing Fetch** – Retrieves project-level spend data using GCP Cloud Billing API.\n5. **Data Parser** – Combines and cleans data from all three clouds into a unified format.\n6. **Cost Spike Detector** – Identifies unusual spending patterns or budget overruns.\n7. **Owner Identifier** – Matches resources to their respective owners or teams.\n8. **Auto-Tag Resource** – Tags the affected resource for quick identification and follow-up.\n9. **Alert Sender** – Sends notifications through Email, WhatsApp, and Slack with detailed cost reports."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "3e35fbfb-6c60-4cf3-a680-bc0fb7e7239e",
"connections": {
"51f29b8b-cbc0-41e4-8116-1768cc411073": {
"main": [
[
{
"node": "6eb4ef65-cdc4-43eb-86f4-00a063b50e90",
"type": "main",
"index": 0
}
]
]
},
"b172287e-8522-4204-af8c-a85554e1b9f8": {
"main": [
[
{
"node": "9a9bbc21-a699-499e-8c49-1e93ae8304ff",
"type": "main",
"index": 0
},
{
"node": "df146231-83a9-4a21-abcd-d614aeed73d2",
"type": "main",
"index": 0
},
{
"node": "cc6d124d-c8fe-4da7-ab36-46d5f4d896bf",
"type": "main",
"index": 0
}
]
]
},
"ee98766c-e7e2-4f2c-8d25-9b25a8d9ef24": {
"main": [
[
{
"node": "8eb36fe2-846e-47db-9771-38648146a629",
"type": "main",
"index": 0
}
],
[
{
"node": "8eb36fe2-846e-47db-9771-38648146a629",
"type": "main",
"index": 0
}
]
]
},
"9a9bbc21-a699-499e-8c49-1e93ae8304ff": {
"main": [
[
{
"node": "51f29b8b-cbc0-41e4-8116-1768cc411073",
"type": "main",
"index": 0
}
]
]
},
"8eb36fe2-846e-47db-9771-38648146a629": {
"main": [
[
{
"node": "7cfa7945-ad77-46aa-9942-30a27bc77d55",
"type": "main",
"index": 0
},
{
"node": "becc8559-a46a-4d31-a2f9-9b92d2de2d55",
"type": "main",
"index": 0
},
{
"node": "d07764c6-fc5b-4614-ad39-b9373b67daaa",
"type": "main",
"index": 0
}
]
]
},
"cc6d124d-c8fe-4da7-ab36-46d5f4d896bf": {
"main": [
[
{
"node": "51f29b8b-cbc0-41e4-8116-1768cc411073",
"type": "main",
"index": 0
}
]
]
},
"df146231-83a9-4a21-abcd-d614aeed73d2": {
"main": [
[
{
"node": "51f29b8b-cbc0-41e4-8116-1768cc411073",
"type": "main",
"index": 0
}
]
]
},
"6eb4ef65-cdc4-43eb-86f4-00a063b50e90": {
"main": [
[
{
"node": "ee98766c-e7e2-4f2c-8d25-9b25a8d9ef24",
"type": "main",
"index": 0
}
]
]
},
"d07764c6-fc5b-4614-ad39-b9373b67daaa": {
"main": [
[]
]
}
}
}このワークフローの使い方は?
上記のJSON設定コードをコピーし、n8nインスタンスで新しいワークフローを作成して「JSONからインポート」を選択、設定を貼り付けて認証情報を必要に応じて変更してください。
このワークフローはどんな場面に適していますか?
中級 - DevOps, マルチモーダルAI
有料ですか?
このワークフローは完全無料です。ただし、ワークフローで使用するサードパーティサービス(OpenAI APIなど)は別途料金が発生する場合があります。
関連ワークフロー
Oneclick AI Squad
@oneclick-aiThe AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.
このワークフローを共有