EC2生命周期管理器与AI聊天助手(描述、启动、停止、重启、终止)
高级
这是一个DevOps, AI Chatbot领域的自动化工作流,包含 16 个节点。主要使用 Agent, HttpRequestTool, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 等节点。 含AI聊天代理的AWS EC2生命周期管理器(描述、启动、停止、重启)
前置要求
- •可能需要目标 API 的认证凭证
- •OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
"id": "ikTVURA2ASogFn99",
"meta": {
"instanceId": "e145bfb15cacc90e0d1ae6ee743e6744f8fc7108de50458700cb2ae620dc5ca5",
"templateCredsSetupCompleted": true
},
"name": "EC2 生命周期管理器与 AI 聊天助手(描述、启动、停止、重启、终止)",
"tags": [
{
"id": "zVkByIt5M465W2a8",
"name": "aws",
"createdAt": "2025-09-12T06:14:33.823Z",
"updatedAt": "2025-09-12T06:14:33.823Z"
},
{
"id": "yWCPKVRlpoRhCpMO",
"name": "Chatbot",
"createdAt": "2025-09-07T13:41:21.818Z",
"updatedAt": "2025-09-07T13:41:21.818Z"
}
],
"nodes": [
{
"id": "961b680a-008c-43ae-8396-154cbee1c2e2",
"name": "OpenAI Chat Model",
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
"position": [
-128,
160
],
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "gpt-4.1-mini"
},
"options": {}
},
"credentials": {
"openAiApi": {
"id": "tnXtbK3d66hDjxXa",
"name": "OpenAi account"
}
},
"typeVersion": 1.2
},
{
"id": "a1bc7d6e-c5d0-4a50-b211-7302725a0601",
"name": "描述实例",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
128,
160
],
"parameters": {
"url": "https://ec2.us-east-1.amazonaws.com",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "Action",
"value": "DescribeInstances"
},
{
"name": "Version",
"value": "2016-11-15"
}
]
},
"toolDescription": "🔍 Lists EC2 instances in your account/region, including IDs, tags, state (running, stopped, etc.).\n👉 Useful for checking status before taking actions.",
"nodeCredentialType": "aws"
},
"credentials": {
"aws": {
"id": "4CZd3hXptJlZimiB",
"name": "AWS account"
}
},
"typeVersion": 4.2
},
{
"id": "a25f84ba-5059-4021-9b7a-c36b61f13032",
"name": "启动实例",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
256,
160
],
"parameters": {
"url": "https://ec2.us-east-1.amazonaws.com",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "Action",
"value": "StartInstances"
},
{
"name": "InstanceId.1",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', ``, 'string') }}"
},
{
"name": "Version",
"value": "2016-11-15"
}
]
},
"toolDescription": "▶️ Boots up a stopped EC2 instance.\n👉 Use when you need to bring a development, test, or production server online.",
"headerParameters": {
"parameters": [
{}
]
},
"nodeCredentialType": "aws"
},
"credentials": {
"aws": {
"id": "4CZd3hXptJlZimiB",
"name": "AWS account"
}
},
"typeVersion": 4.2
},
{
"id": "2ffcc823-3818-4d2b-b690-b208848e5026",
"name": "停止实例",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
384,
160
],
"parameters": {
"url": "https://ec2.us-east-1.amazonaws.com",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "Action",
"value": "StopInstances"
},
{
"name": "InstanceId.1",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', ``, 'string') }}"
},
{
"name": "Version",
"value": "2016-11-15"
}
]
},
"toolDescription": "⏹ Gracefully shuts down a running EC2 instance (data on EBS volumes is preserved).\n👉 Good for saving costs when servers are not needed.",
"headerParameters": {
"parameters": [
{}
]
},
"nodeCredentialType": "aws"
},
"credentials": {
"aws": {
"id": "4CZd3hXptJlZimiB",
"name": "AWS account"
}
},
"typeVersion": 4.2
},
{
"id": "73d01f7e-9ac0-47c2-9e90-09b20d609adc",
"name": "重启实例",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
512,
160
],
"parameters": {
"url": "https://ec2.us-east-1.amazonaws.com",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "Action",
"value": "RebootInstances"
},
{
"name": "InstanceId.1",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', ``, 'string') }}"
},
{
"name": "Version",
"value": "2016-11-15"
}
]
},
"toolDescription": "🔄 Restarts a running EC2 instance (like pressing reset on a machine).\n👉 Useful for applying patches or fixing temporary issues without stopping/starting.",
"headerParameters": {
"parameters": [
{}
]
},
"nodeCredentialType": "aws"
},
"credentials": {
"aws": {
"id": "4CZd3hXptJlZimiB",
"name": "AWS account"
}
},
"typeVersion": 4.2
},
{
"id": "6540a32d-59ee-4280-98de-1a0cd08df7b4",
"name": "终止实例",
"type": "n8n-nodes-base.httpRequestTool",
"position": [
640,
160
],
"parameters": {
"url": "https://ec2.us-east-1.amazonaws.com",
"method": "POST",
"options": {},
"sendBody": true,
"contentType": "form-urlencoded",
"sendHeaders": true,
"authentication": "predefinedCredentialType",
"bodyParameters": {
"parameters": [
{
"name": "Action",
"value": "TerminateInstances"
},
{
"name": "InstanceId.1",
"value": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('parameters1_Value', ``, 'string') }}"
},
{
"name": "Version",
"value": "2016-11-15"
}
]
},
"toolDescription": "💀 Permanently shuts down and deletes an EC2 instance (EBS root volume may also be deleted if configured).\n👉 Use with caution — this cannot be undone.",
"headerParameters": {
"parameters": [
{}
]
},
"nodeCredentialType": "aws"
},
"credentials": {
"aws": {
"id": "4CZd3hXptJlZimiB",
"name": "AWS account"
}
},
"typeVersion": 4.2
},
{
"id": "2df9a6bc-2826-4df6-8b5e-e08395a67c1d",
"name": "当收到聊天消息时",
"type": "@n8n/n8n-nodes-langchain.chatTrigger",
"position": [
-352,
-64
],
"webhookId": "32788287-2cdd-49cf-b554-2aceb2e2c52d",
"parameters": {
"options": {}
},
"typeVersion": 1.3
},
{
"id": "d3125105-b7ae-4eed-b7bc-14ee92e49786",
"name": "简单记忆",
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
"position": [
0,
160
],
"parameters": {
"contextWindowLength": 10
},
"typeVersion": 1.3
},
{
"id": "47627ae7-9533-400b-85a3-550fab6f49fb",
"name": "EC2 管理器 AI 助手",
"type": "@n8n/n8n-nodes-langchain.agent",
"position": [
184,
-64
],
"parameters": {
"text": "={{ $json.chatInput }}",
"options": {
"systemMessage": "You are an AI DevOps Assistant specialized in managing AWS EC2 instances.\nYour role is to help engineers interact with EC2 in natural language by:\n1. Understanding their intent (describe, start, stop, reboot, terminate).\n2. Asking clarifying questions if information is missing (e.g., instance ID, environment, region).\n3. Mapping the request to the correct EC2 API tool.\n4. Calling the appropriate tool with precise parameters.\n5. Summarizing results in a clear, concise way for the user.\n\nRules:\n- Never assume instance ID, region, or environment without confirming with the user.\n- Always explain the action before execution, unless the user explicitly says \"do it now\".\n- If multiple instances are affected, confirm scope before calling the tool.\n- Use simple, DevOps-friendly responses (short, technical, direct).\n- After each action, provide feedback like: \"✅ Instance i-123456 stopped successfully\".\n- Always maintain safety: highlight that *terminate* is irreversible before execution.\n\nAvailable Tools:\n1. DescribeInstances – Get status and details of instances.\n2. StartInstances – Start stopped instance(s).\n3. StopInstances – Stop running instance(s).\n4. RebootInstances – Restart instance(s).\n5. TerminateInstances – Permanently delete instance(s)."
},
"promptType": "define"
},
"typeVersion": 2.2
},
{
"id": "121e09b5-033d-4433-b3c5-e56099b495d0",
"name": "便签",
"type": "n8n-nodes-base.stickyNote",
"position": [
-2240,
-672
],
"parameters": {
"color": 5,
"width": 1088,
"height": 1824,
"content": "# EC2 生命周期管理器与 AI 聊天助手(描述、启动、停止、重启、终止)"
},
"typeVersion": 1
},
{
"id": "17a9a095-0056-413c-8d41-4e27986f592d",
"name": "便签1",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1088,
-576
],
"parameters": {
"width": 672,
"height": 928,
"content": ""
},
"typeVersion": 1
},
{
"id": "2c91d833-b465-4f76-ba7b-1b52cc99a7ac",
"name": "便签 2",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
-400
],
"parameters": {
"width": 1232,
"height": 400,
"content": "# AI 助手终止的实例"
},
"typeVersion": 1
},
{
"id": "2bbbd4fe-99ec-4f68-95d4-99afce09b20b",
"name": "便签 3",
"type": "n8n-nodes-base.stickyNote",
"position": [
848,
16
],
"parameters": {
"width": 1232,
"height": 416,
"content": "# AI 助手停止的实例"
},
"typeVersion": 1
},
{
"id": "b7a1dd2f-f489-44ec-a743-bc86ebcebfea",
"name": "便签 4",
"type": "n8n-nodes-base.stickyNote",
"position": [
-1088,
384
],
"parameters": {
"width": 672,
"height": 640,
"content": ""
},
"typeVersion": 1
},
{
"id": "868fb44f-162d-4f5b-9b00-b4f2615ea5c0",
"name": "便签 5",
"type": "n8n-nodes-base.stickyNote",
"position": [
-368,
-400
],
"parameters": {
"color": 5,
"width": 544,
"height": 224,
"content": "### 1. 聊天步骤 — \"当收到聊天消息时\""
},
"typeVersion": 1
},
{
"id": "6705e1b5-d00b-4bbe-8267-86e3ff5aa2e3",
"name": "便签6",
"type": "n8n-nodes-base.stickyNote",
"position": [
224,
-464
],
"parameters": {
"color": 5,
"width": 544,
"height": 320,
"content": "### 2. 助手步骤 — \"EC2 管理器 AI 助手\""
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"versionId": "6392a799-1c97-4968-ab80-37ad1d676a01",
"connections": {
"Simple Memory": {
"ai_memory": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_memory",
"index": 0
}
]
]
},
"Stop Instance": {
"ai_tool": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Start Instance": {
"ai_tool": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Reboot Instance": {
"ai_tool": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"Describe Instance": {
"ai_tool": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"OpenAI Chat Model": {
"ai_languageModel": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Terminate Instance": {
"ai_tool": [
[
{
"node": "EC2 Manager AI Agent",
"type": "ai_tool",
"index": 0
}
]
]
},
"EC2 Manager AI Agent": {
"main": [
[]
]
},
"When chat message received": {
"main": [
[
{
"node": "EC2 Manager AI Agent",
"type": "main",
"index": 0
}
]
]
}
}
}常见问题
如何使用这个工作流?
复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。
这个工作流适合什么场景?
高级 - 开发运维, AI 聊天机器人
需要付费吗?
本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。
相关工作流推荐
基于聊天的AWS Lambda管理器与自动化审计日志记录(GPT-4.1 mini + Google表格)
通过聊天使用GPT-4.1和Google表格审计日志记录的AWS Lambda管理器
Aws Lambda Tool
Agent
Http Request Tool
+5
15 节点Trung Tran
开发运维
基于聊天的AWS IAM策略生成器与AI助手(OpenAI)
通过聊天界面使用GPT-4助手生成AWS IAM策略
Email Send
Http Request
Agent
+5
14 节点Trung Tran
开发运维
n8n中带审计日志的AI驱动AWS S3管理器(Slack/ChatOps工作流)
通过Slack使用GPT-4代理和Google表格审计日志管理AWS S3
Aws S3 Tool
Agent
Google Sheets Tool
+4
16 节点Trung Tran
开发运维
智能聊天机器人
使用GPT-5-nano、网络搜索和对话记忆构建智能聊天机器人
Chat
Agent
Http Request Tool
+4
13 节点Oriol Seguí
杂项
构建具有聊天界面和多种工具的交互式AI助手
构建具有聊天界面和多种工具的交互式AI助手
Crypto Tool
Date Time Tool
Agent
+9
17 节点Lucas Peyrin
个人效率
LeadBot 自动驾驶 — Salesforce 聊天转线索
基于 Salesforce 和 GPT 的对话式线索捕获与日程安排
Slack Tool
Email Send Tool
Salesforce Tool
+7
25 节点Le Nguyen
AI 聊天机器人
工作流信息
难度等级
高级
节点数量16
分类2
节点类型6
作者
Trung Tran
@trungtranEmpowering small and medium businesses with smart automation and practical AI, no big tech team required. Youtube channel: youtube.com/@theStackExplorer
外部链接
在 n8n.io 查看 →
分享此工作流