Sources
Connect Amazon S3 as a source
Give Artie read access to an S3 bucket, then map its CSV, JSON, Parquet or ACH files to destination tables so each new file lands as rows.
Prerequisites
- S3 sources turned on for your company. Ask your Artie contact; self-serve and free plans can’t use S3 as a source.
- An S3 bucket that holds the files, and its AWS Region.
- Permission to create an IAM user or IAM role in the AWS account that owns the bucket.
- Files you don’t want ingested moved out of the prefixes you plan to map. Artie reads every object already under a mapping’s prefix when it starts.
Grant Artie access to the bucket
Artie connects with an IAM user’s access key or by assuming an IAM role. Either identity needs this permissions policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "*"
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::BUCKET_NAME"
},
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::BUCKET_NAME/*"
}
]
}Replace BUCKET_NAME with your bucket’s name. Each action covers one job:
| Action | What Artie uses it for |
|---|---|
s3:ListAllMyBuckets | Lists your buckets in the Bucket name field |
s3:ListBucket | Lists the objects under each mapping’s prefix |
s3:GetObject | Reads each file |
Create the identity for the authentication method you plan to use in Artie.
- Create an IAM user and attach the permissions policy.
- Create an access key for the user.
In Artie, enter the key in AWS access key ID and AWS secret access key.
Create an IAM role with this trust policy. It lets Artie’s AWS principal, arn:aws:iam::788826912768:user/ci, assume the role.
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::788826912768:user/ci"
},
"Action": "sts:AssumeRole",
"Condition": {
"StringEquals": {
"sts:ExternalId": "EXTERNAL_ID"
}
}
}
]
}Replace EXTERNAL_ID with the value you enter in AWS external ID (optional). If you leave that field blank, delete the Condition block. With the field blank, Artie sends no external ID, so a trust policy that still requires one rejects the request.
Attach the permissions policy to the role. In Artie, enter the role’s ARN in AWS role ARN.
Connect S3 in Artie
S3 has no Network access or Prepare source step. Each path mapping writes to a destination table, so you set up the destination before adding mappings.
Choose S3
On the home page, select New pipeline. On Choose source, select S3.
Enter the connection details
On Connect and verify, set Authentication method to the method you set up in AWS, and enter its credentials. Select the AWS region, then pick your bucket in Bucket name.
The list shows the buckets your credentials can see. Type the name instead if your bucket isn’t listed.
Verify the source
Select Verify source. When the step shows Source verified, select Continue.
Set up the destination
On Choose tables, the Path mappings section asks for a destination first. Select Set up destination, then choose and connect your destination.
The destination check needs at least one path mapping, so select Verify later on the destination’s Connect and verify step.
Add path mappings
In the setup sidebar, select Choose tables. Select Add path mapping, fill in the fields in Configure path mappings, and select Add mapping. Add one mapping for each group of files.
Deploy the pipeline
On Review and deploy, select Validate and deploy.
Verify the first file
Upload a file that matches one mapping, then check its destination table. Artie picks the file up on its next listing once the file is 10 seconds old. Listings run 60 seconds apart. With File path on, the artieSourcePath column holds the file’s object key.
Configure path mappings
A path mapping sends matching objects in the bucket to one destination table. Several mappings can read the same files into different tables, and several can write to one table. Nothing replicates until at least one mapping exists.
During setup, mappings are on the Choose tables step. On an existing pipeline, edit them on the pipeline page’s Path mappings tab. Changes apply after you save and deploy the pipeline.
Mapping fields
Each mapping has these fields:
| Field | Required | What it does |
|---|---|---|
| Prefix | Yes | Selects the objects under this key prefix. A prefix without a trailing slash matches as a folder: orders matches orders/a.csv but not orders-2024.csv. |
| File name pattern | No | A regular expression matched against the base file name, after a .gz suffix is removed. Blank matches every object under the prefix. |
| Format | Yes | CSV (default), JSON, Parquet or ACH. Artie detects gzip-compressed objects and decompresses them in every format. |
| Destination | Yes | An existing table in the destination, or Create a new table with a Table name. |
| Primary key | No | The columns that uniquely identify a row. Blank keys rows by file path and line number. |
File name pattern never includes the prefix. For example, ^orders-[0-9]+\.csv$ matches incoming/orders/orders-42.csv and incoming/orders/orders-42.csv.gz. Lookarounds and backreferences aren’t supported.
Two mappings can’t read the same prefix and pattern into the same table. Saving one shows These files already map to TABLE_NAME.
CSV options
CSV mappings have these extra options:
| Option | What it does |
|---|---|
| Delimiter | The single character between fields. Default ,. It cannot be a quote, newline or carriage return. |
| Comment prefix | Skips rows that start with this single character. It must differ from the delimiter. |
| Header | Column names for files without a header row. Empty reads the names from row 1. |
| Null value | Values to read as NULL, for example \N. |
| Trim whitespace | Removes leading and trailing whitespace from every value. |
Primary keys
Set a primary key, such as order_id, when later files restate earlier rows, as recurring snapshots do. Matching destination rows then update in place. Without a primary key, Artie keys each row by artieSourcePath and artieSourceRecordNumber, so each new file adds rows.
A mapping without a primary key needs File path and Line number turned on in Metadata columns; it won’t save otherwise. Every row needs a value in each key column, or the file fails.
Metadata columns
Metadata columns record where each row came from. Turn them on per mapping:
| Checkbox | Column | Value | On by default |
|---|---|---|---|
| File path | artieSourcePath | The full object key | Yes |
| Line number | artieSourceRecordNumber | The row’s position in the file, starting at 1 | Yes |
| Ingested at | artieSourceIngestedAt | When Artie read the row, in UTC | Yes |
| File name | artieSourceFileName | The last segment of the object key | No |
| Last modified | artieSourceLastModified | The object’s S3 last-modified time | No |
| ETag | artieSourceETag | The object’s S3 ETag | No |
File requirements
Each format accepts one file shape:
| Format | Accepted file | What becomes a row |
|---|---|---|
| CSV | A header row, or names set in Header. Every data row has as many fields as the header. | Each data row. Every value is read as a string. |
| JSON | One top-level array of objects, or newline-delimited JSON (NDJSON) with one object per line, up to 16 MiB per line. | Each object. Nested objects and arrays are written as JSON text. |
| Parquet | A flat schema of primitive, optional and repeated-primitive columns. Nested structs, maps and lists of structs fail the file. | Each row. |
| ACH | A structurally valid NACHA file. Artie does not check check digits or batch totals. | Each entry detail record. File and batch header and control fields repeat on every row, and addenda go in an addenda column. |
In a CSV file whose header has 2 or more columns, a row with a single field ends the file. Artie treats it as a trailer and skips any rows after it. An ACH file that fails to parse is rejected whole, and none of its rows are written.
Edit or remove a mapping
Keep a mapping once it has processed files. Artie stores each mapping’s progress under an ID it assigns on first save, so editing the prefix, pattern or table keeps that progress. Objects under a new prefix that are older than the checkpoint are skipped.
Removing a mapping and adding it again creates a new mapping, which re-reads every object under its prefix. Removing the last mapping for a table removes that table from the pipeline.
File processing and checkpoints
Artie lists every mapping’s prefix, processes new objects in order of last-modified time, then waits 60 seconds before listing again. It skips an object until it’s at least 10 seconds old, so an upload has time to finish.
On first start, Artie reads every object already under the mapping prefixes, then each new object as it lands. A mapping added later also starts with the objects already under its prefix.
Checkpoints and retries
Each mapping keeps its own checkpoint: the last-modified time and key of the last object it finished. Artie advances it only after the object’s rows are flushed to the destination. Artie skips objects at or before the checkpoint. An object with the same timestamp and a later key is still processed.
If an object fails to parse or flush, Artie stops reading the bucket and reports the error on the pipeline. Artie restarts reading automatically, waiting up to 5 minutes between attempts. Each time, that mapping retries the same object. Its later files wait; other mappings keep their progress.
Ingestion is at least once: after a failed flush, Artie reads the whole object again. A re-read object produces the same row keys as the first read.
Snapshots and deletes
Artie never deletes destination rows for an S3 source. It writes each parsed row as a new or updated row and never compares a file with an earlier one. A row that disappears from a later snapshot stays in the destination. Handle deletions separately when the destination must mirror them.
Schema changes
Columns come from each file’s data. A new field becomes a new column, and a renamed field arrives as a new column. Renaming files doesn’t interrupt ingestion while each file still matches its mapping’s Prefix and File name pattern.
When a destination column already exists, Artie writes values as that column’s type. A value that can’t convert, such as abc in an integer column, fails the file instead of being coerced. On Snowflake and BigQuery only, Artie can turn on a setting that writes NULL for these values instead. On Snowflake it covers bad dates, times, timestamps, numbers and booleans, except in rows that load through Snowpipe Streaming. On BigQuery it covers only bad dates, times and timestamps.
Troubleshoot S3 ingestion
These entries cover a first file that never arrives and a mapping that stops partway.
The test file doesn’t arrive
Check each of these for the file and its mapping:
- The file is in the bucket set in Bucket name, and that bucket is in the selected AWS region.
- Its key is under the mapping’s Prefix, and its base name matches File name pattern.
- It’s at least 10 seconds old, and a listing has run since (one runs every 60 seconds).
- Its last-modified time is later than the mapping’s checkpoint. An edited prefix keeps the old checkpoint.
- The IAM user or role has the three actions in Grant Artie access to the bucket.
- For an object encrypted with a customer-managed AWS KMS key, the identity has
kms:Decrypton the key, and the key policy allows it.
If every check passes, open the pipeline’s errors and alerts in Artie. A file that fails stops ingestion with an error that names its mapping and object key, as shown in Later files stop arriving for one mapping.
Later files stop arriving for one mapping
Cause: One object failed to parse or flush. Artie stops reading the bucket and retries that object each time reading restarts, so its mapping doesn’t move past it. The pipeline’s error names the mapping ID and the object key:
S3 consumer stopped: mapping "4f1c9a2e-7b3d-4e8a-9c61-2d5f0b8e1a37" object "incoming/orders/orders-42.csv": row 3 has 4 fields, expected 5Common errors that stop a file:
| Error | Cause |
|---|---|
row N has X fields, expected Y | A CSV data row has a different field count from the header |
duplicate header column "NAME" | A CSV header repeats a column name |
primary key "COLUMN" is missing or nil | A row has no value in a primary key column |
parquet column "NAME" is a nested group | The Parquet file has a nested column |
ach: read file: ... | The ACH file is structurally invalid |
Fix: Correct the file and upload it under a new key, then move the failed object out of the mapping’s prefix. Artie retries only objects it still lists.
Verify: After the next listing, the mapping’s later files arrive in the destination table.
Was this page helpful?
- Need help? Message us on Slack or email [email protected].
- Want a walkthrough? Book a demo.
- LLM? Read llms.txt.