---
title: "n8n"
sidebar_label: "n8n"
sidebar_position: 16
description: "How to configure n8n and work with S3"
---

import Formbricks from '@theme/MDXComponents/Formbricks'
import GrantAccess from '@site/i18n/en/docusaurus-plugin-content-docs/current/_partials/s3/grant-access.mdx'
import PlusIcon from '@selectel/docux/icons/plus'
import CloseIcon from '@selectel/docux/icons/close'

# n8n

n8n is an open-source workflow automation platform. It lets you connect services and applications without coding and automate work with S3-compatible storage. n8n has ready-to-use nodes for object-, prefix-, and bucket-level management.

## Configure n8n \{#configure-n8n}

1. [Set up access to S3](#configure-access-to-s3).
2. [Prepare n8n](#prepare-n8n).
3. [Connect S3 to n8n](#connect-s3-to-n8n).

### 1. Configure access to S3 \{#configure-access-to-s3}

<GrantAccess />

### 2. Prepare n8n \{#prepare-n8n}

You can:

* purchase an n8n instance on the [n8n website](https://n8n.io/) and install it on any server or device;
* or use a pre-configured [cloud server with n8n](/cloud-servers/applications/ml-ai/n8n.mdx).

### 3. Connect S3 to n8n \{#connect-s3-to-n8n}

1. Open n8n.

2. In the left menu, click <PlusIcon /> and select **New credential**.

3. In the search box, enter **S3**.

4. Click **Continue**.

5. At the **Connection** step:

   5.1. In the **S3 Endpoint** field, specify the [S3 API domain](/s3/manage/domains.mdx#s3-api-domains). The domain depends on the [pool](/infrastructure/locations.mdx#pool) where S3 is located.

   5.2. In the **Region** field, enter the [pool](/infrastructure/locations.mdx#pool) where S3 is located.

   5.3. In the **Access Key ID** field, enter the value of the **Access key** field from the S3 key that you [obtained in step 1](#configure-access-to-s3).

   5.4. In the **Secret Access Key** field, enter the value of the **Secret key** field from the S3 key that you [obtained in step 1](#configure-access-to-s3).

   5.5. Configure the **Force Path Style** toggle switch depending on the [addressing type](/s3/buckets/addressing-types.mdx) in the bucket. If you use:

   * Virtual-Hosted addressing — leave the toggle disabled;
   * Path-Style addressing — enable the toggle.

   5.6. Make sure that the **Ignore SSL Issues (Insecure)** toggle switch is turned off.

   5.7. Click **Save** → <CloseIcon />.

6. Check the connection:

   6.1. In the left menu, click <PlusIcon /> and select **New workflow**.

   6.2. Click **Add first step** and select **Trigger Manually**.

   6.3. To the right of the node, click <PlusIcon /> and select **S3**.

   6.4. In the **Actions** list, select **Get many buckets**.

   6.5. Click **Execute step**. Upon successful connection, a list of buckets in the pool you specified in step 5.2 will be displayed.

## Example of configuring scheduled data backup \{#backup-on-schedule-example}

In the example, n8n will retrieve data from an external service every day and save it to a bucket with the date in the object name.

1. If you do not have an S3 bucket yet, [create one](/s3/buckets/create-bucket.mdx).

2. Open n8n.

3. Configure the Schedule Trigger node:

   3.1. In the left menu, click <PlusIcon /> and select **New workflow**.

   3.2. Click **Add first step** and select **Schedule Trigger**.

   3.3. In the **Trigger Interval** field, select the unit of time in which you will specify the trigger frequency.

   3.4. Depending on the value selected in step 2.3, configure the trigger frequency in the additional fields.

   3.5. In the top right corner, click <CloseIcon />. The data will be saved automatically.

4. Configure the HTTP Request node:

   4.1. To the right of the Schedule Trigger node, click <PlusIcon /> and select **HTTP Request**.

   4.2. In the **Method** field, select **GET**.

   4.3. In the **URL** field, enter the address from which data is retrieved for backup.

   4.4. If the source:

   * requires authentication — in the **Authentication** field, select an authentication method and enter credentials;
   * does not require authentication — leave the value **None**.

   4.5. If the request response is returned as a file, for example an archive, in the **Options** section, click **Add option** → **Response** and in the **Response Format** field, select **File**. The data will go into a binary field and can be uploaded to S3 as an object.

   4.6. Check the node operation: click **Execute step**. If the node runs successfully, the files will be displayed in the **Output** section.

   4.7. In the top right corner, click <CloseIcon />. The data will be saved automatically.

5. Configure the Upload a file node:

   5.1. To the right of the HTTP Request node, click <PlusIcon /> and select **S3** → **Upload a file**.

   5.2. Make sure that the **Credential** field contains the credentials you added in step 5 when [connecting S3 to n8n in step 3](#connect-s3-to-n8n).

   5.3. In the **Resource** field, select **File**.

   5.4. In the **Operation** field, select **Upload**.

   5.5. In the **Bucket Name** field, enter the name of the bucket to which the files will be uploaded.

   5.6. In the **File Name** field, enter the name template for the uploaded objects. You can specify a name template with a prefix. For example, for the template `backups/{{ $now.format('yyyy-LL-dd') }}.json`:

   * the object will be uploaded under the prefix `/backups`;
   * the expression in double curly braces will substitute the current date.

   The object name will look like `backups/2026-06-02.json`.

   5.7. If you specified **File** in the **Response Format** field in step 4.5, turn on the **Binary File** toggle switch.

   5.8. If in step 5.7 you:

   * turned on the **Binary File** toggle switch — in the **Input Binary Field** field, enter the name of the binary field from the HTTP Request node that you configured in step 3, by default `data`;
   * did not turn on the **Binary File** toggle switch — in the **File Content** field, specify the key that contains the data to upload. For example, to reference the entire response, specify `{{ $json }}`. To reference a specific field, for example `body`, specify `{{ $json.body }}`.

   5.9. Check the node operation: click **Execute step**. If the node runs successfully, an object will appear in the bucket with a name like `backups/2026-06-02.json`.

   5.10. In the top right corner, click <CloseIcon />. The data will be saved automatically.

6. Check the operation of the node chain: click **Execute workflow**.

7. Start the backup automation:

   7.1. In the top right corner, click **Publish**.

   7.2. Enter the name of the automation version.

   7.3. Click **Publish**.

## Example of configuring automatic cleanup of old objects \{#automatic-old-objects-cleaning-example}

In the example, n8n will delete objects with the prefix `/backups` uploaded more than 30 days ago once a day.

1. If you do not have an S3 bucket yet, [create one](/s3/buckets/create-bucket.mdx).

2. Open n8n.

3. Configure the Schedule Trigger node:

   3.1. In the left menu, click <PlusIcon /> and select **New workflow**.

   3.2. Click **Add first step** and select **Schedule Trigger**.

   3.3. In the **Trigger Interval** field, select the unit of time in which you will specify the trigger frequency.

   3.4. Depending on the value you selected in step 2.3, configure the trigger frequency in the additional fields.

   3.5. In the top right corner, click <CloseIcon />. The data will be saved automatically.

4. Configure the Get many files node:

   4.1. To the right of the Schedule Trigger node, click <PlusIcon /> and select **S3** → **Get many files**.

   4.2. In the **Resource** field, select **File**.

   4.3. In the **Operation** field, select **Get many**.

   4.4. In the **Bucket Name** field, enter the bucket name.

   4.5. Configure the number of objects the node will return. For the node to return:

   * all objects — turn on the **Return All** toggle switch;
   * limited number of objects — leave the **Return All** toggle switch turned off and in the **Limit** field, enter the number of objects to be returned.

   4.6. To add a prefix, in the **Options** section, click **Add field** → **Folder Key** and enter the prefix for objects to be deleted, in the example `backup/`.

   4.7. Check the node operation: click **Execute step**. If the node runs successfully, a list of objects will be displayed in the **Output** section.

   4.8. In the top right corner, click <CloseIcon />. The data will be saved automatically.

5. Configure the Filter node:

   5.1. To the right of the Get many files node, click <PlusIcon /> and select **Filter**.

   5.2. In the condition section, in the data type field, select **Boolean** → **Is true**.

   5.3. In the value field, select **Expression** and enter the expression that will identify objects older than 30 days:

   ```bash
   {{ $json.LastModified.toDateTime().toUTC() <= $now.minus({ days: 30 }).toUTC() }}
   ```

   5.4. Turn on the **Convert types where required** toggle switch.

   5.5. Check the node operation: click **Execute step**. If the node runs successfully, the **Output** → **Table** section will display objects that pass the filter (the **Kept** block) and do not pass (the **Discarded** block).

   5.6. In the top right corner, click <CloseIcon />. The data will be saved automatically.

6. Configure the Delete a file node:

   6.1. To the right of the Filter node, click <PlusIcon /> and select **S3** → **Delete a file**.

   6.2. In the **Resource** field, select **File**.

   6.3. In the **Operation** field, select **Delete**.

   6.4. In the **Bucket Name** field, enter the bucket name.

   6.5. In the **File Name** field, select **Expression** and enter the expression `{{ $json.Key }}`.

   6.6. In the top right corner, click <CloseIcon />. The data will be saved automatically.

7. Configure the Loop Over Items node:

   7.1. To the right of the Delete a file node, click <PlusIcon /> and select **Loop Over Items**.

   7.2. Delete the empty nodes added alongside the Loop Over Items node.

   7.3. Connect the output of the Loop Over Items node to the input of the Delete a file node.

8. Check the operation of the node chain: click **Execute workflow**.

9. Start the automation for deleting old files:

   9.1. In the top right corner, click **Publish**.

   9.2. Enter the name of the automation version.

   9.3. Click **Publish**.

<Formbricks />
