8
n8n 中文网amn8n.com

n8n中带审计日志的AI驱动AWS S3管理器(Slack/ChatOps工作流)

高级

这是一个DevOps, AI Chatbot领域的自动化工作流,包含 16 个节点。主要使用 AwsS3Tool, Agent, GoogleSheetsTool, ChatTrigger, LmChatOpenAi 等节点。 通过Slack使用GPT-4代理和Google表格审计日志管理AWS S3

前置要求
  • AWS Access Key 和 Secret
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "0mnXbzHdP3r7Uk5p",
  "meta": {
    "instanceId": "e145bfb15cacc90e0d1ae6ee743e6744f8fc7108de50458700cb2ae620dc5ca5",
    "templateCredsSetupCompleted": true
  },
  "name": "n8n 中带审计日志的 AI 驱动 AWS S3 管理器(Slack/ChatOps 工作流)",
  "tags": [
    {
      "id": "zVkByIt5M465W2a8",
      "name": "aws",
      "createdAt": "2025-09-12T06:14:33.823Z",
      "updatedAt": "2025-09-12T06:14:33.823Z"
    }
  ],
  "nodes": [
    {
      "id": "e61c5d1b-7c6a-486a-b7ab-8af828dfb2e1",
      "name": "OpenAI 聊天模型",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -160,
        736
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "tnXtbK3d66hDjxXa",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "198007d2-5b4f-449e-8e6b-b54c76bf394a",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -32,
        736
      ],
      "parameters": {
        "contextWindowLength": 10
      },
      "typeVersion": 1.3
    },
    {
      "id": "b57e9ec2-dd1d-496d-947f-40f1c18e5506",
      "name": "AWS S3 管理器 Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        280,
        512
      ],
      "parameters": {
        "options": {
          "systemMessage": "You are an intelligent assistant for managing AWS S3 via natural language.\n\nYou are equipped with 7 tools:\n\n1. ListBuckets — to list all available S3 buckets.\n2. ListObjects — to list files in a specific bucket or prefix.\n3. CopyObject — to copy a file from one bucket/key to another.\n4. DeleteObject — to delete a file from an S3 bucket.\n5. ListFolders — to list top-level folders using S3 prefixes.\n6. CreateFolder — to create a new folder using a zero-byte object with a trailing slash.\n7. AddAuditLog — to log all tool calls to Google Sheets (via appendOrUpdate: sheet).\n\nYour responsibilities:\n\n- Parse user requests, determine intent, and call the appropriate S3 tool.\n- Immediately after executing **any of the first 6 tools**, you **must call the `AddAuditLog` tool** with full context.\n- **Do NOT call AddAuditLog** if:\n  - You didn’t call any operational tool\n  - The tool being executed is already `AddAuditLog` (to avoid loops)\n\n---\n\n### The audit log entry (AddAuditLog) should include:\n\n```json\n{\n  \"timestamp\": \"<UTC timestamp>\",\n  \"tool\": \"<ToolName used>\",\n  \"parameters\": { /* tool call parameters */ },\n  \"status\": \"success\",\n  \"user\": {\n    \"name\": \"<if available>\",\n    \"source\": \"<e.g., Slack, Telegram>\"\n  },\n  \"chat_prompt\": \"<original user message>\",\n  \"tool_call_reasoning\": \"<why this tool was chosen>\"\n}"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "d8acd9a1-bd45-4953-82ae-bb27ef449011",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -384,
        512
      ],
      "webhookId": "7d48edec-7760-43f3-87da-c4721a69468a",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.3
    },
    {
      "id": "28fc7970-7fd7-44b3-bf4e-1281c322bb65",
      "name": "获取 AWS S3 中的多个存储桶",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        96,
        736
      ],
      "parameters": {
        "resource": "bucket",
        "operation": "getAll",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}"
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "ddea4199-a84f-4c66-8764-18bb609ec4e7",
      "name": "获取 AWS S3 中的多个文件",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        224,
        736
      ],
      "parameters": {
        "options": {},
        "operation": "getAll",
        "returnAll": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Return_All', ``, 'boolean') }}",
        "bucketName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Bucket_Name', ``, 'string') }}"
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "faf57b94-3073-47e6-ac88-5203fb2d9ad6",
      "name": "在 AWS S3 中复制文件",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        352,
        736
      ],
      "parameters": {
        "operation": "copy",
        "sourcePath": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Source_Path', ``, 'string') }}",
        "destinationPath": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Destination_Path', ``, 'string') }}",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2099f8fa-d295-47f3-a014-2d22b35f4676",
      "name": "在 AWS S3 中删除文件",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        480,
        736
      ],
      "parameters": {
        "fileKey": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('File_Key', ``, 'string') }}",
        "options": {},
        "operation": "delete",
        "bucketName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Bucket_Name', ``, 'string') }}"
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0b5fc6f0-43e2-4000-b58e-6ffe240d99bf",
      "name": "获取 AWS S3 中的多个文件夹",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        608,
        736
      ],
      "parameters": {
        "options": {},
        "resource": "folder",
        "operation": "getAll",
        "returnAll": "",
        "bucketName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Bucket_Name', ``, 'string') }}"
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "71afb290-a9e8-4ac7-bf02-09687ab630cd",
      "name": "在 AWS S3 中创建文件夹",
      "type": "n8n-nodes-base.awsS3Tool",
      "position": [
        736,
        736
      ],
      "parameters": {
        "resource": "folder",
        "bucketName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Bucket_Name', ``, 'string') }}",
        "folderName": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Folder_Name', ``, 'string') }}",
        "additionalFields": {}
      },
      "credentials": {
        "aws": {
          "id": "Q5gor70maeAQPEU4",
          "name": "AWS account 2"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "046374dc-9b0f-460a-85a6-5e53ba2648d4",
      "name": "在 Google Sheets 中追加或更新行",
      "type": "n8n-nodes-base.googleSheetsTool",
      "position": [
        864,
        736
      ],
      "parameters": {
        "columns": {
          "value": {},
          "schema": [],
          "mappingMode": "autoMapInputData",
          "matchingColumns": [],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "appendOrUpdate",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aaDJ9ZAt2LLpZDFcXjVaYW57JwyruCrl5UJWejG1ZTk/edit#gid=0",
          "cachedResultName": "Sheet1"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1aaDJ9ZAt2LLpZDFcXjVaYW57JwyruCrl5UJWejG1ZTk",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1aaDJ9ZAt2LLpZDFcXjVaYW57JwyruCrl5UJWejG1ZTk/edit?usp=drivesdk",
          "cachedResultName": "AWS S3 Audit Logs"
        }
      },
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "7zk8xcj4pNU6f1WM",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "df1923d0-a7b5-44a4-808e-380d4784b007",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1280,
        -96
      ],
      "parameters": {
        "color": 6,
        "width": 832,
        "height": 1856,
        "content": "# n8n 中带审计日志的 AI 驱动 AWS S3 管理器(Slack/ChatOps 工作流)"
      },
      "typeVersion": 1
    },
    {
      "id": "a0f2d80c-3e15-4316-82a2-10145760e966",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -400,
        352
      ],
      "parameters": {
        "color": 5,
        "height": 112,
        "content": "### **Webhook 触发器**"
      },
      "typeVersion": 1
    },
    {
      "id": "e099afbd-5f92-40d3-aa3e-c22e719c0574",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        256
      ],
      "parameters": {
        "color": 5,
        "height": 208,
        "content": ""
      },
      "typeVersion": 1
    },
    {
      "id": "2e6816bd-f7b4-4332-ae3f-864410083a6e",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        304,
        928
      ],
      "parameters": {
        "color": 5,
        "width": 304,
        "height": 256,
        "content": "### **AWS S3 节点**"
      },
      "typeVersion": 1
    },
    {
      "id": "da526631-6758-4c91-be12-7d279a8e7fd0",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        800,
        928
      ],
      "parameters": {
        "color": 5,
        "height": 256,
        "content": "### **Google Sheets 节点**"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ac313ae3-60e9-4145-8c45-72c3192a96f2",
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "AWS S3 Manager Agent": {
      "main": [
        []
      ]
    },
    "Copy a file in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Delete a file in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many files in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Create a folder in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many buckets in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get many folders in AWS S3": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Append or update row in sheet in Google Sheets": {
      "ai_tool": [
        [
          {
            "node": "AWS S3 Manager Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

高级 - 开发运维, AI 聊天机器人

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
高级
节点数量16
分类2
节点类型7
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

作者
Trung Tran

Trung Tran

@trungtran

Empowering small and medium businesses with smart automation and practical AI, no big tech team required. Youtube channel: youtube.com/@theStackExplorer

外部链接
在 n8n.io 查看

分享此工作流