Skip to main content

Amazon S3

The Amazon S3 connector reads, writes, lists and deletes files in an S3 bucket, or in any storage that speaks the S3 API. Mention it as @extfs_s3. Each run can take the next new file as a pipeline item.

Connect​

The credential is an AWS access key: Access Key ID and Secret Access Key. Give the key access to the bucket and nothing more. Test Connection lists your buckets, so with such a key it reports access denied; runs still work. Connectors, instances and credentials covers the rest of the setup.

SettingDefaultWhat it does
Bucket NameNone, requiredThe bucket the workflow works in.
Regionus-east-1The bucket's region.
S3 Endpointhttps://s3.amazonaws.comChange it for S3-compatible storage, such as MinIO or Cloudflare R2. Test from the connector's settings after you set it; the test in the credential dialog always goes to AWS.
Include sub-foldersOffWhen on, a scan for new files also looks in the folders below the one the workflow scans. Files in those folders are matched by their path below the scanned folder, so start a claim pattern with *, such as *.pdf or *INV-*.pdf.

What a step can do​

ActionWhat it does
claim_next_fileClaims the next available file for this run. claim_next_files claims several at once.
get_fileCopies a file into the run's files.
put_fileUploads a file from the run's files. If a file with that name is already there, the step fails, unless the step says to replace it.
delete_fileDeletes a file.
list_filesLists files in a folder. It returns one file unless the step asks for more, and by default only files no run has taken yet; a step can ask for every file instead. A listing of new files reads at most 5,000 files and sub-folders from the folder, counting the files that don't match the step's pattern. When it stops there short of the number asked for, it says more may exist; claim_next_files takes them.
mark_file_processedMarks a claimed file Success or Failed. mark_files_processed marks several at once.

Take the next new PDF from @extfs_s3 under incoming/. Extract the invoice fields with @unstract, then upload the results as JSON to processed/ in @extfs_s3.

How runs read the files​

Unstract Flow reads the bucket only while a run is going; nothing watches it between runs. When a run claims a file, Flow takes a file it has already found in that folder, and in its sub-folders when Include sub-folders is on, for this connector instance, matching the step's pattern if it has one. A new instance has no record of earlier runs, so it processes every file already in the folder again; so does an imported workflow, even one imported into the same organization. When none is left, it scans the folder for new files, at most once every 30 seconds for each folder and pattern, shared by runs working in parallel. The scan looks in that folder only, unless the connector's Include sub-folders setting is on. The run copies the file into its own files at the same relative path, and a later step marks it Success or Failed. If a run ends with a file still in progress, the file is marked Failed once eight hours have passed since the claim; the check runs every 5 minutes. To free it sooner, select Release claims in the details of a run that ended Partial, Failed or Cancelled. Pipelines covers the states.

A file larger than 500 MB can't be copied into a run or uploaded, and a copy or an upload must finish within three minutes. Flow tells files apart by their S3 ETag. For most uploads that follows the content, so a copy under another name isn't picked up again and a changed file counts as new. A file uploaded in parts, or encrypted with KMS, can get a different ETag for the same content and is then picked up again.