本页内容
Sommatic 文档
打开控制台

AWS - S3 Storage

在 Amazon S3 或兼容 S3 的存储上上传、下载、列出和删除对象。

以 Markdown 查看
在以下应用中打开
集成 可用 integrations.aws.s3.storage 版本 1.0.0 执行方式: async

使用 AWS SDK v3 对兼容 S3 的存储桶执行一次 S3 操作(getObject、putObject、listObjects 或 deleteObject),并将 SDK 结果放在 result 中返回。

连接你的 AWS 账户,自动化对象存储操作:存储文件、获取文档、列出存储桶内容,以及管理对象生命周期。

操作:

  • Get Object: 按键下载对象内容。
  • Put Object: 将内容上传到存储桶中的指定键。
  • List Objects: 列出存储桶中的对象,可按前缀过滤。
  • Delete Object: 按键删除对象。

工作原理

  1. 解析节点配置中的表达式。若 connection_id、bucket、operation、key 或 body 为空,worker 会从输入项($json)读取同名字段。
  2. 必须提供 connection_id、bucket 和 operation。
  3. 在服务端解析凭据。支持的类型:object、basic-auth 或 custom,需包含 accessKeyId 和 secretAccessKey(或 access_key_id / secret_access_key),可选 region(默认 us-east-1)和 endpoint。设置自定义 endpoint 后客户端改用 path-style 寻址。
  4. 发送命令:getObject 读取 key 并以 UTF-8 字符串返回内容;putObject 将 body 上传到 key;listObjects 以 key 作为前缀列出存储桶;deleteObject 删除 key。
  5. 成功时经 out 返回 { result }。任何失败(包括校验错误)都以 { error } 经 error 返回;节点不会抛出异常。

在工作流中

节点在工作流文件(draft_nodes[])中的写法,以及一次成功运行的 envelope。

{
  "node_id": "node-read-report",
  "label": "Read daily report",
  "operator_slug": "integrations.aws.s3.storage",
  "operator_version": "1.0.0",
  "config": {
    "connection_id": "pi-credential-xxxx",
    "bucket": "reports",
    "operation": "getObject",
    "key": "daily/{{ $json.date }}.csv"
  }
}

配置

connection_id string 必填

兼容 S3 的存储账户凭据。接受 `object`(或 `basic-auth` / `custom`)类型的凭据,字段为 `{ accessKeyId, secretAccessKey, region?, endpoint? }`。AWS 不支持 `connection-string` 形式的凭据。

bucket string 必填 支持表达式

要操作的 S3 存储桶名称。

operation string 必填

要执行的存储操作。

默认值: getObject

可选值: getObjectputObjectlistObjectsdeleteObject

key string 可选 支持表达式

对象在存储桶中的路径/键(例如“reports/2024/summary.pdf”)。

显示条件: operation = getObject | putObject | deleteObject

body string 可选 支持表达式

作为对象正文上传的内容(字符串或 base64)。

显示条件: operation = putObject

代码中的行为

除 schema 描述之外,实现代码对这些键的实际处理。

key
在 listObjects 中作为 Prefix 使用(为空则列出整个存储桶),尽管表单只在其他操作中显示该字段。
body
按原样上传。base64 字符串会作为文本存储,worker 不会解码。
connection_id
以 { 开头的值会被解析为内联 JSON 设置(accessKeyId、secretAccessKey、region、endpoint),并跳过凭据库。仅用于本地测试;在工作流中请使用已保存的凭据。

输出端口

out 默认

S3 调用成功。getObject 时 result 为对象内容字符串;其他操作时为 SDK 原始响应(例如 listObjects 的 Contents、KeyCount、IsTruncated,或 putObject 的 ETag)。

数据
{
  "result": "order_id,total\nord_123,129.99\n"
}
error

校验、凭据解析或 S3 调用失败。

数据
{
  "error": "The specified key does not exist."
}

在表达式中

后续节点可通过 $("AWS - S3 Storage").item.json.<路径> 读取此节点输出中的内容(请把 AWS - S3 Storage 换成你的节点标签)。Editor 标记工作流编辑器在 Previous Nodes 中提示的路径(输出契约);Worker 标记 worker 实际通过 out 返回的路径,依据“端口”一节所示的输出。

表达式EditorWorker
$("AWS - S3 Storage").item.json.resultobject= "order_id,total\nord_123,129.99\n"S3 操作结果或元数据

错误

消息 端口 原因与处理
connection_id is required error 配置和输入项中都没有凭据。bucket is required 与 operation is required 同理。
Unknown operation: <operation> error operation 不是 getObject、putObject、listObjects 或 deleteObject 之一(区分大小写)。
Credential <connection_id> has unsupported type '<type>' for integrations.aws.s3.storage. Use 'object' with { accessKeyId, secretAccessKey, region?, endpoint? }. error 凭据类型为 connection-string 或 api-key。请改存为 object 类型凭据。
Credential <connection_id> missing accessKeyId / secretAccessKey error 凭据密钥中缺少这两个字段之一。
Failed to resolve connection <connection_id>: <detail> error 凭据不存在、对当前组织不可用,或无法连接后端。
The specified key does not exist. error 对不存在的键执行 getObject 时的 S3 错误。其他 S3 错误(AccessDenied、NoSuchBucket)也按原样传递。

输入契约

connection_id string 必填
bucket string 必填
operation string 必填
key string 可选
body string 可选

输出契约

result object 可选

S3 操作结果或元数据

契约(JSON Schema)

与编排器声明完全一致的定义。All 是完整的 *.definition.js;可与上方各节对照,找出文档与 schema 之间的差异。发布前可用它校验节点。

{
  "slug": "integrations.aws.s3.storage",
  "name": "AWS - S3 Storage",
  "category": "integrations",
  "version": "1.0.0",
  "description": "Upload, download, list, and delete objects on Amazon S3 or S3-compatible storage.\n\n  Connect your AWS account and automate object storage operations — store files, retrieve documents, list bucket contents, and manage object lifecycle.\n\n  **Operations:**\n  - **Get Object:** Download an object's content by key.\n  - **Put Object:** Upload content to a specific key in the bucket.\n  - **List Objects:** List objects in a bucket with optional prefix filtering.\n  - **Delete Object:** Remove an object by key.",
  "capabilities": [
    "storage",
    "s3",
    "files",
    "aws",
    "cloud"
  ],
  "group": [
    {
      "key": "aws",
      "name": "AWS",
      "icon_url": "/icons/integrations/aws/aws.svg"
    }
  ],
  "icon_url": "/icons/integrations/aws/s3.svg",
  "config_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string",
        "title": "AWS S3 Credential",
        "description": "Credential for your S3-compatible storage account. Accepts credentials of type `object` (or `basic-auth` / `custom`) with fields `{ accessKeyId, secretAccessKey, region?, endpoint? }`. AWS does not support `connection-string` style credentials.",
        "ui_widget": "connection_picker",
        "ui_options": {
          "credential_types": [
            "object",
            "basic-auth",
            "custom"
          ],
          "types": [
            "s3"
          ]
        }
      },
      "bucket": {
        "type": "string",
        "title": "Bucket",
        "description": "Name of the S3 bucket to operate on.",
        "format": "expression"
      },
      "operation": {
        "type": "string",
        "title": "Operation",
        "enum": [
          "getObject",
          "putObject",
          "listObjects",
          "deleteObject"
        ],
        "default": "getObject",
        "description": "The storage operation to perform."
      },
      "key": {
        "type": "string",
        "title": "Object Key",
        "description": "Path/key of the object in the bucket (e.g., \"reports/2024/summary.pdf\").",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "getObject",
              "putObject",
              "deleteObject"
            ]
          }
        }
      },
      "body": {
        "type": "string",
        "title": "Content",
        "description": "Content to upload as the object body (string or base64).",
        "format": "expression",
        "displayOptions": {
          "show": {
            "operation": [
              "putObject"
            ]
          }
        }
      }
    },
    "required": [
      "connection_id",
      "bucket",
      "operation"
    ]
  },
  "input_contract_schema": {
    "type": "object",
    "properties": {
      "connection_id": {
        "type": "string"
      },
      "bucket": {
        "type": "string"
      },
      "operation": {
        "type": "string"
      },
      "key": {
        "type": "string"
      },
      "body": {
        "type": "string"
      }
    },
    "required": [
      "connection_id",
      "bucket",
      "operation"
    ]
  },
  "output_contract_schema": {
    "type": "object",
    "properties": {
      "result": {
        "type": "object",
        "description": "S3 operation result or metadata"
      }
    }
  },
  "ports": [
    {
      "port_id": "out",
      "label": "Result",
      "description": "Operation result (content, metadata, or list)",
      "is_default": true,
      "supports_condition": true
    },
    {
      "port_id": "error",
      "label": "Error",
      "description": "Storage operation failed",
      "is_default": false,
      "supports_condition": false
    }
  ],
  "execution_mode": "async",
  "required_resources": [],
  "compatible_worker_pools": [
    "standard-io",
    "cloud-io"
  ],
  "tags": [
    "storage",
    "cloud",
    "aws"
  ],
  "is_stateful": false,
  "publisher": {
    "identity": "org_sommatic_ai",
    "profile": {
      "name": "Sommatic AI",
      "verified": true,
      "url": "https://sommatic.ai",
      "logo_url": null
    }
  }
}

执行

执行方式
async
有状态
否
凭据
在服务器端根据 connection_id 解析,密钥不会进入工作流。
能力
storages3filesawscloud
标签
storagecloudaws

说明与限制

  • listObjects 只返回一页(按 S3 API 最多 1,000 个键),不会发送续传令牌。对于大量数据,请检查 IsTruncated 并缩小前缀范围。
  • getObject 会将内容按文本解码,二进制对象(PDF、图片)无法完整返回。
  • 不重试:调用失败直接进入 error。

已对照编排器代码核实 · 31e874b · 2026-11-26

安装智能体工具

为你的编程智能体接入 Sommatic AI 官方文档:技能包、文档 MCP 服务器与 Markdown 页面,无需再抓取网页。

仅安装技能包,不会自动更新;需要时重新运行即可。

npx skills add https://docs.sommatic.ai
智能体如何读取本文档