# AWS - S3 Storage

> Upload, download, list, and delete objects on Amazon S3 or S3-compatible storage.

Source: https://docs.sommatic.ai/en/nodes/integrations.aws.s3.storage/

- Slug: `integrations.aws.s3.storage`
- Family: Integrations
- Version: 1.0.0
- Status: Available
- Execution: async

Upload, download, list, and delete objects on Amazon S3 or S3-compatible storage.

Connect your AWS account and automate object storage operations — store files, retrieve documents, list bucket contents, and manage object lifecycle.

**Operations:**
- **Get Object:** Download an object's content by key.
- **Put Object:** Upload content to a specific key in the bucket.
- **List Objects:** List objects in a bucket with optional prefix filtering.
- **Delete Object:** Remove an object by key.

## Configuration

- `connection_id` (string, required): 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.
- `bucket` (string, required, accepts expressions): Name of the S3 bucket to operate on.
- `operation` (string, required): The storage operation to perform. Default: `getObject`. Allowed values: `getObject`, `putObject`, `listObjects`, `deleteObject`.
- `key` (string, optional, accepts expressions): Path/key of the object in the bucket (e.g., "reports/2024/summary.pdf"). Shown when: operation = `getObject` | `putObject` | `deleteObject`.
- `body` (string, optional, accepts expressions): Content to upload as the object body (string or base64). Shown when: operation = `putObject`.

## Output ports

- `out` (default): Operation result (content, metadata, or list)
- `error`: Storage operation failed

## Input contract

- `connection_id` (string, required)
- `bucket` (string, required)
- `operation` (string, required)
- `key` (string, optional)
- `body` (string, optional)

## Output contract

- `result` (object, optional): S3 operation result or metadata

## In expressions

What a later node can read from this node's output with `$("AWS - S3 Storage").item.json.<path>` (write your node's label instead of `AWS - S3 Storage`). **Editor** marks the paths the workflow editor suggests under Previous Nodes (the output contract); **Worker** marks the paths the worker really returns through `out`, from the output shown in Ports.

- `$("AWS - S3 Storage").item.json.result` (object) = `"order_id,total\nord_123,129.99\n"`: S3 operation result or metadata


## How it works

Runs one S3 operation (getObject, putObject, listObjects or deleteObject) against an S3-compatible bucket with the AWS SDK v3 and returns the SDK result under `result`.

1. Resolves the expressions of the node config. When `connection_id`, `bucket`, `operation`, `key` or `body` is empty, the worker reads the field of the same name from the incoming item (`$json`).
2. Requires `connection_id`, `bucket` and `operation`.
3. Resolves the credential on the server. Accepted types: `object`, `basic-auth` or `custom`, with `accessKeyId` and `secretAccessKey` (or `access_key_id` / `secret_access_key`), and optional `region` (default `us-east-1`) and `endpoint`. A custom `endpoint` switches the client to path-style addressing.
4. Sends the command: `getObject` reads `key` and returns its body as a UTF-8 string; `putObject` uploads `body` to `key`; `listObjects` lists the bucket using `key` as the prefix; `deleteObject` deletes `key`.
5. Returns `{ result }` on `out`. Any failure, including validation errors, is returned as `{ error }` on `error`; the node never throws.

## In a workflow

### Node

```json
{
  "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"
  }
}
```

### Envelope

```json
{
  "ok": true,
  "data": {
    "result": "order_id,total\nord_123,129.99\n"
  },
  "port": "out"
}
```

## Output ports (behaviour in the code)

### `out`

The S3 call succeeded. `result` is the object body as a string for `getObject`, and the raw SDK response (for example `Contents`, `KeyCount`, `IsTruncated` for `listObjects`, or `ETag` for `putObject`) for the other operations.

```json
{
  "result": "order_id,total\nord_123,129.99\n"
}
```

### `error`

Validation, credential resolution or the S3 call failed.

```json
{
  "error": "The specified key does not exist."
}
```

## Behaviour in the code

- `key`: For `listObjects` it is used as the `Prefix` (empty lists the whole bucket), although the form only shows it for the other operations.
- `body`: Uploaded as-is. A base64 string is stored as text; the worker does not decode it.
- `connection_id`: A value starting with `{` is parsed as inline JSON settings (`accessKeyId`, `secretAccessKey`, `region`, `endpoint`) and the vault is skipped. This exists for local tests; use a stored credential in workflows.

## Errors

| Message | Port | Cause and fix |
| --- | --- | --- |
| `connection_id is required` | `error` | No credential in the config or in the incoming item. The same pattern applies to `bucket is required` and `operation is required`. |
| `Unknown operation: <operation>` | `error` | `operation` is not one of getObject, putObject, listObjects or deleteObject (the names are case-sensitive). |
| `Credential <connection_id> has unsupported type '<type>' for integrations.aws.s3.storage. Use 'object' with { accessKeyId, secretAccessKey, region?, endpoint? }.` | `error` | The credential is a `connection-string` or `api-key`. Store it as an `object` credential. |
| `Credential <connection_id> missing accessKeyId / secretAccessKey` | `error` | The credential secret lacks one of the two keys. |
| `Failed to resolve connection <connection_id>: <detail>` | `error` | The credential does not exist, is not available to this organization, or the backend could not be reached. |
| `The specified key does not exist.` | `error` | S3 error for `getObject` on a missing key. Other S3 errors (AccessDenied, NoSuchBucket) are passed through the same way. |

## Notes and limits

- `listObjects` returns a single page (at most 1,000 keys per the S3 API). No continuation token is sent, so check `IsTruncated` and narrow the prefix for larger listings.
- `getObject` decodes the body as text. Binary objects (PDF, images) are not returned intact.
- No retries: a failed call goes straight to `error`.


## Contracts (JSON Schema)

### All (`*.definition.js`)

```json
{
  "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
    }
  }
}
```

### config_schema

```json
{
  "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

```json
{
  "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

```json
{
  "type": "object",
  "properties": {
    "result": {
      "type": "object",
      "description": "S3 operation result or metadata"
    }
  }
}
```

### ports

```json
[
  {
    "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
  }
]
```
